Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
OlofBlomqvist committed Feb 11, 2024
1 parent 0b3bbba commit dfbe31b
Show file tree
Hide file tree
Showing 48 changed files with 2,819 additions and 1,689 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

*_db

# Just for local nts stuff
TODO.MD

8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/marlowe_indexer.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,36 @@
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'marlowe_indexer'",
"name": "Debug executable 'cardano_chain_sync_graphql'",
"cargo": {
"args": [
"build",
"--bin=marlowe_indexer",
"--package=marlowe_indexer"
"--bin=cardano_chain_sync_graphql",
"--package=cardano_chain_sync_graphql"
],
"filter": {
"name": "marlowe_indexer",
"name": "cardano_chain_sync_graphql",
"kind": "bin"
}
},
"args": [],
"args": [
"-f","socket-sync" ,"--network=preprod"
],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'marlowe_indexer'",
"name": "Debug unit tests in executable 'cardano_chain_sync_graphql'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=marlowe_indexer",
"--package=marlowe_indexer"
"--bin=cardano_chain_sync_graphql",
"--package=cardano_chain_sync_graphql"
],
"filter": {
"name": "marlowe_indexer",
"name": "cardano_chain_sync_graphql",
"kind": "bin"
}
},
Expand Down
65 changes: 59 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
[workspace]
resolver = "2"
members = [
"cardano_chain_sync",
"marlowe_indexer",
]
[package]
name = "marlowe-indexer"
version = "0.0.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
#cardano_chain_sync = { path = "../cardano_chain_sync" }
tokio = { version ="1.28.0", features = ["full"] }
anyhow = { version ="1.0.71" }
error-stack = {version="0.4.0", features=["std","anyhow","hooks"]}
pallas = "0.18.1"
pallas-primitives = "0.18.1"
pallas-traverse = "0.18.1"
pallas-crypto = "*"
#pallas_network = { git = "https://github.com/OlofBlomqvist/pallas", branch="feat-win-pipes", package="pallas-network" }
pallas-network = { path = "C:/Users/oblink/Documents/GitHub/pallas/pallas-network" }
#pallas_network = { git = "https://github.com/txpipe/pallas.git", branch = "main", package = "pallas-network" }
#pallas-network = { path = "C:/Users/oblink/Documents/GitHub/pallas/pallas-network" }
#pallas_network = { git = "https://github.com/OlofBlomqvist/pallas", branch="feat-win-pipes", package="pallas-network" }
warp = "0.3"
thiserror = "1.0.40"
tonic = "*"
#marlowe_lang = { version = "0.1.22",features=["unstable","utils"] }
#marlowe_lang = { path = "../../marlowe_rust",features=["unstable","utils"] }
marlowe_lang = { git = "https://github.com/OlofBlomqvist/marlowe_lang",features=["unstable","utils"],branch = "master"}
hex = "0.4.3"
async-graphql = { version= "6.0.6", features=["dynamic-schema"]}
async-graphql-warp = "6.0.4"
async-trait = "0.1.68"
serde_json = "1.0.96"
env_logger = "0.10.0"
bs58 = "*"
ctrlc = "3.1"
reqwest = "*"
crossterm = "*"
clap = "4.3.21"
structopt = "0.3.26"
strum_macros = "0.25.2"
futures-timer = "3.0.2"
serde = "1.0.183"


opentelemetry = {version="0.20",features=["rt-tokio"]}
opentelemetry-stdout = { version = "0.1.0", features = ["trace"] }
tracing = "0.1"
tracing-opentelemetry = "0.20"
tracing-subscriber = { version = "0.3", features=["std","env-filter","fmt"] }
opentelemetry-otlp = "0.13.0"
crossbeam = "0.8.2"
sled = "0.34.7"
futures = "0.3.28"
bytes = "1.5.0"
chrono = "0.4.31"
rand = "0.8.5"

[features]
debug = []
61 changes: 30 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
![CI Build](https://github.com/olofblomqvist/marlowe-indexer/actions/workflows/rust.yml/badge.svg?branch=main)

# Marlowe Sync (indexer)
⚠️ **This project is highly unstable and not recommended for use in production systems.**

An indexer for Marlowe smart contracts on the Cardano blockchain.
Exposes indexed data via graphql.
# Marlowe Indexer (WIP)

Current state of this repository: Early alpha/poc phase
This is an experimental indexer for Marlowe contracts on the Cardano blockchain, based on the Haskell implementation by IOG [here](https://github.com/input-output-hk/marlowe-cardano/).

**NOT YET READY FOR PRODUCTION USE**

# What works?

- Sync against cardano node over TCP/IP, UnixSocket or named pipes.
- Indexing of contracts using the V1 and V1+Audited Marlowe validators.
- Basic GraphQL server exposing:
- All indexed contracts
- Marlowe State / datum (in json format)
- Marlowe Redeemer, also in json format
- Generic info about each tx involved in a contract
- Limited filtering
- Pagination

# How it works
### How it works

- Communicates via Cardano Nodes using [Pallas](https://github.com/txpipe/pallas) by the [txpipe](https://github.com/txpipe) team.
- Decoding of Marlowe on-chain data via [Marlowe_Lang](https://github.com/OlofBlomqvist/marlowe_lang).
- GraphQL server using [Async-GraphQL](https://github.com/async-graphql/async-graphql) & [Warp](https://github.com/seanmonstar/warp)

# How to run?
### How to run?

*Pre-built binaries will be provided at a later date.*

1. Make sure you have Rust installed: https://www.rust-lang.org/tools/install
2. Clone the repository
3. Run the application using one of the following ways:
```powershell
```bash

# Connect to a local node (defaults to CARDANO_NODE_SOCKET_PATH)
cargo run socket-sync --network=preprod
Expand All @@ -51,17 +38,29 @@ Current state of this repository: Early alpha/poc phase

![graphql](https://github.com/OlofBlomqvist/marlowe_indexer/blob/main/graphql.png)

# Planned features

*In no particular order*
## Current features

- Configuration via file
- Customization of how to store marlowe data: JSON/CBOR etc
- Data Persistance (redis,mongodb,file-system,etc?)
- GraphQL subscriptions (with filtering)
- Stabilize structure of stored data (what to store about each contract and how)
- Sync against cardano node over TCP/IP, UnixSocket or named pipes.
- Indexing of contracts using the V1 and V1+Audited Marlowe validators.
- Basic GraphQL server exposing:
- All indexed contracts
- Marlowe State / datum (in json format)
- Marlowe Redeemer, also in json format
- Generic info about each tx involved in a contract
- Limited filtering
- Pagination
- Subscription for contract events

# Code quality
### Planned features

- Initially during POC, shortcuts will be taken..
- Will be improved greatly before V1 release.
*In no particular order*

- Improve estimation sync
- Configuration via file
- Persistance (redis,mongodb,file-system,etc?)
- Indexing of addresses and their contents
- Improved subscriptions and filters such as
- Filter contracts based on Open Role Tokens
- Filter contracts based on available withdrawals/payouts
- Oracle helper subscriptions and API's
1 change: 0 additions & 1 deletion cardano_chain_sync/.gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions cardano_chain_sync/Cargo.toml

This file was deleted.

50 changes: 0 additions & 50 deletions marlowe_indexer/Cargo.toml

This file was deleted.

31 changes: 0 additions & 31 deletions marlowe_indexer/src/graphql/mod.rs

This file was deleted.

Loading

0 comments on commit dfbe31b

Please sign in to comment.