An open API service indexing awesome lists of open source software.

https://github.com/codila125/foedus-blockchain

Foedus is a complete blockchain implementation featuring Proof-of-Work consensus, UTXO transaction model, smart contracts with milestone tracking, and both CLI and REST API interfaces. Built in Go for performance and simplicity.
https://github.com/codila125/foedus-blockchain

bitcoin blockchain blockchain-technology ethereum go golang

Last synced: 4 months ago
JSON representation

Foedus is a complete blockchain implementation featuring Proof-of-Work consensus, UTXO transaction model, smart contracts with milestone tracking, and both CLI and REST API interfaces. Built in Go for performance and simplicity.

Awesome Lists containing this project

README

          

# Foedus Blockchain

![Cover](images/cover-template.png)


Immutable Contract Infrastructure


Features β€’
Quick Start β€’
API β€’
Contracts β€’
Deploy


Version 0.4.0
Production Ready
Go 1.25+
MIT License
Docker Ready

---

## Overview

Foedus is a **production-ready blockchain platform** enabling governments and enterprises to create, manage, and enforce immutable contracts. Built for legislative compliance and corporate accountability, it provides tamper-proof records with full audit trails.

**Built for:**
- πŸ›οΈ **Government Bodies** enforcing legislative contracts and public agreements
- 🏒 **Enterprises** requiring legally binding, immutable contract records
- βš–οΈ **Regulatory Compliance** with transparent, auditable contract histories
- 🀝 **Public-Private Partnerships** coordinating multi-party agreements

---

## Features

### πŸ“œ Immutable Contract Records
Every contract, amendment, and approval is permanently recorded on the blockchain. Once committed, records cannot be altered or deletedβ€”ensuring absolute integrity for legal and regulatory purposes.

### πŸ›οΈ Multi-Party Governance
Support for multiple signatories including government agencies, corporate entities, and authorized representatives. All parties must cryptographically approve before contracts become active.

### πŸ“‹ Milestone-Based Execution
Track contract fulfillment through defined milestones. Each completion requires evidence submission and multi-party approval, creating a verifiable chain of accountability.

### πŸ” Cryptographic Security
Ed25519 digital signatures and SHA-256 hashing ensure non-repudiation. Every action is cryptographically signed, providing legally defensible proof of authorization.

### πŸ“Š Complete Audit Trail
Full transaction history accessible for regulatory audits, legal discovery, and compliance verification. Export complete blockchain records on demand.

### πŸš€ Enterprise Deployment
Production-ready Docker deployment with health monitoring, graceful shutdown, and persistent storage. Integrates with existing government and enterprise infrastructure via RESTful API.

---

## Quick Start

### Docker (Recommended)

```bash
# Pull and run
docker pull codila125/foedus-blockchain:latest
docker run -d -p 3008:3008 --name foedus codila125/foedus-blockchain:latest

# Verify it's running
curl http://localhost:3008/health
# {"status":"ok"}
```

### With Persistent Storage

```bash
docker volume create foedus-data
docker volume create foedus-logs

docker run -d \
--name foedus \
-p 3008:3008 \
-p 3009:3009 \
-p 3010:3010 \
-v foedus-data:/app/data \
-v foedus-logs:/var/log/foedus \
codila125/foedus-blockchain:0.4.0
```

### Build from Source

```bash
git clone https://github.com/codila125/foedus-blockchain.git
cd foedus-blockchain
docker build -t foedus-blockchain .
docker run -d -p 3008:3008 --name foedus foedus-blockchain
```

---

## API Reference

Base URL: `http://localhost:3008`

### Health Check
```
GET /health
```
Returns `{"status":"ok"}` when service is operational.

### Wallet Operations

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/blockchain/createwallet` | GET | Generate new wallet |
| `/blockchain/listaddresses` | GET | List all wallet addresses |
| `/blockchain/getbalance/{address}` | GET | Get wallet balance |

### Smart Contract Operations

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/blockchain/createcontract/{address}` | POST | Create new contract |
| `/blockchain/getcontract/{contractID}` | GET | Get contract details |
| `/blockchain/approvecontract` | POST | Approve contract |
| `/blockchain/approvemilestone` | POST | Complete milestone |
| `/blockchain/cancelcontract` | POST | Cancel contract |

### Blockchain Queries

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/blockchain/printchain` | GET | Export full blockchain |

---

## Smart Contracts

### Create a Contract

```bash
curl -X POST http://localhost:3008/blockchain/createcontract/{creator_address} \
-H "Content-Type: application/json" \
-d '{
"title": "Infrastructure Development Agreement",
"description": "Public-private partnership for highway construction",
"milestones": [
{
"title": "Phase 1: Land Acquisition",
"description": "Complete land acquisition and permits",
"value": 5000000,
"due_date": 1762329600
},
{
"title": "Phase 2: Construction",
"description": "Complete primary construction",
"value": 25000000,
"due_date": 1793865600
}
],
"parties": [
{"address": "{government_agency}", "role": "REGULATOR"},
{"address": "{contractor}", "role": "CONTRACTOR"},
{"address": "{oversight_body}", "role": "ARBITRATOR"}
],
"terms": "Funds released upon milestone approval by all parties"
}'
```

### Contract Lifecycle

```
DRAFT β†’ ACTIVE β†’ COMPLETED
↓ ↓
└───────┴──→ CANCELLED
```

1. **DRAFT**: Contract proposed, awaiting party approvals
2. **ACTIVE**: All authorized signatories approved, milestones in progress
3. **COMPLETED**: All milestones fulfilled and verified
4. **CANCELLED**: Contract terminated with full audit record

### Use Cases

| Sector | Application |
|--------|-------------|
| **Government** | Legislative contracts, procurement agreements, inter-agency MOUs |
| **Infrastructure** | Public-private partnerships, construction milestones |
| **Healthcare** | Pharmaceutical supply contracts, compliance agreements |
| **Finance** | Regulatory filings, audit trails, cross-border agreements |
| **Energy** | Power purchase agreements, environmental compliance |

---

## Deployment

### Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `NODE_ID` | `3008` | API server port |
| `SOURCE_NODE_ID` | `3008` | Source node identifier |
| `MINER_NODE_ID` | `3011` | Miner node identifier |

### Ports

| Port | Service |
|------|---------|
| `3008` | HTTP API |
| `3009` | P2P Source Node |
| `3010` | P2P Miner Node |

### Health Checks

Docker health checks are built-in:
```bash
# Check container health
docker inspect --format='{{.State.Health.Status}}' foedus
```

### Logs

```bash
# View logs
docker logs -f foedus

# Access log files (if using volumes)
docker exec foedus cat /var/log/foedus/source.log
```

---

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HTTP API (Chi) β”‚
β”‚ GET/POST /blockchain/* β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Blockchain Core β”‚
β”‚ UTXO Model β€’ Proof-of-Work β€’ Smart Contracts β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Infrastructure β”‚
β”‚ libp2p Network β€’ PebbleDB β€’ Ed25519 Crypto β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## Technical Specifications

| Component | Technology |
|-----------|------------|
| Consensus | Proof-of-Work (SHA-256) |
| Signatures | Ed25519 |
| Storage | PebbleDB (LSM-tree) |
| Networking | libp2p (TCP) |
| Serialization | Protocol Buffers v3 |
| API Framework | Chi Router |

---

## Module Documentation

| Module | Description |
|--------|-------------|
| [api/](api/) | RESTful HTTP server |
| [blockchain/](blockchain/) | Core consensus engine |
| [network/](network/) | P2P communication |
| [wallet/](wallet/) | Key management |
| [database/](database/) | Storage layer |
| [merkle/](merkle/) | Transaction verification |
| [cli/](cli/) | Command-line interface |

---

## Support

- **Documentation**: [GitHub Wiki](https://github.com/codila125/foedus-blockchain/wiki)
- **Issues**: [GitHub Issues](https://github.com/codila125/foedus-blockchain/issues)
- **Docker Hub**: [codila125/foedus-blockchain](https://hub.docker.com/r/codila125/foedus-blockchain)
- **Enterprise Inquiries**: Contact for dedicated support and custom deployments

---

## License

MIT License - see [LICENSE](LICENSE) for details.

---


Foedus v0.4.0 β€” Immutable Contract Infrastructure for Government & Enterprise