Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
41cd684
Changed config to support V8 envs
br41nlet Oct 4, 2024
18fcaaf
Deprecated Updated
br41nlet Oct 4, 2024
8bec6d6
Removed Update related functions
br41nlet Oct 4, 2024
6548763
Removed default gas price
br41nlet Oct 7, 2024
909d7d0
Update paranet create (registerParanet) function
zsculac Oct 7, 2024
0effd75
Add logic for curated nodes and miners
zsculac Oct 8, 2024
efeb747
Update dkg.py abi
zsculac Oct 9, 2024
92df516
Add curated paranet demo
zsculac Oct 10, 2024
e98c0ce
Add ParanetNodesAccessPolicy and ParanetMinersAccessPolicy enums
zsculac Oct 11, 2024
0296fe0
Improve variable naming
zsculac Oct 11, 2024
d060ac9
Add variables to make demo clearer
zsculac Oct 14, 2024
986816b
Remove duplicate constants
zsculac Oct 14, 2024
f982b01
rename parameters for better clarity
zsculac Oct 14, 2024
fb85c5c
Code formatting
br41nlet Oct 14, 2024
4dcde77
Add logic to dynamically fetch identity ids
zsculac Oct 16, 2024
6e412bd
Updated dependencies, added separate mint/local-store/publish operations
br41nlet Oct 16, 2024
c605738
Fixed formatting
br41nlet Oct 16, 2024
0a0f8f5
Removed mint/local-store/publish
br41nlet Oct 16, 2024
518d18c
Removed tuple decoding for curated nodes list getter
br41nlet Oct 16, 2024
68d6fed
[V8] Update paranets functionality (#37)
br41nlet Oct 16, 2024
361d242
Added local_store for curated paranet KA
br41nlet Oct 18, 2024
df86978
Added local_store for curated paranet KA (#40)
br41nlet Oct 21, 2024
57ac5aa
Added missing constant, updated curated paranets demo
br41nlet Oct 23, 2024
4d5837e
Add V8 query
Dec 30, 2024
dae8fd5
format query strings in demo
Dec 31, 2024
509ad74
Add ruff pre-commit hooks
Dec 31, 2024
f3c27e3
Add makefile for easier setup and common commands
Dec 31, 2024
242b33d
Update readme
Dec 31, 2024
3cba62b
update pre commit config
Dec 31, 2024
40dbef0
update makefile
Dec 31, 2024
0007cce
format makefile
Dec 31, 2024
637b447
Add ruff github action
Dec 31, 2024
19a0042
Initial v8 create
Jan 3, 2025
7ddcc6c
implemented v8 get
ilijaMar Jan 6, 2025
87657df
Update abi
Jan 8, 2025
12aaeab
Update DefaultParameters
Jan 8, 2025
b66ec20
Create kc and ka tools
Jan 8, 2025
fb35143
Finish v8 create
Jan 8, 2025
ba92b28
Update demo
Jan 8, 2025
54180e6
Added input service
ilijaMar Jan 8, 2025
ebd411e
Fixes
Jan 8, 2025
d9e03a6
Removed private key
ilijaMar Jan 8, 2025
fdeb5a8
Move private key to .env
Jan 9, 2025
31ce773
Code review changes 1
ilijaMar Jan 9, 2025
b90875f
Update hubs
Jan 9, 2025
c452b0d
Add abis
Jan 9, 2025
61d31a3
PR suggesstions
Jan 9, 2025
f1c9d41
Code review 2
ilijaMar Jan 9, 2025
21571c2
Code changes 3
ilijaMar Jan 9, 2025
7b4e168
Update demo
Jan 9, 2025
0a2e07e
Merge remote-tracking branch 'origin/v8/addapting-client-to-v8' into …
Jan 9, 2025
aa2d662
Merge create query get
Jan 9, 2025
089f5dd
Add constants
Jan 9, 2025
e227816
Update demo
Jan 10, 2025
4c5e9e8
Fix decrease allowance issue
Jan 10, 2025
1397a89
remove local store from constants
Jan 10, 2025
4f6534d
Update demo jsonld and query
Jan 10, 2025
f22a5c2
Update demo
Jan 10, 2025
4ee73c0
Remove local_store, service_agreeement functions and add_tokens
Jan 10, 2025
8579b92
Add mainnet info to constants
Jan 10, 2025
110be08
change default environment from testnet to mainnet
Jan 10, 2025
b70eb57
bind graph.create and graph.get to asset
Jan 10, 2025
c3ec955
V8 Client version 1 (#48)
zsculac Jan 10, 2025
c25854a
Merge branch 'v8/develop' into feature/ruff-formatter
Jan 12, 2025
6861cec
Update readme
Jan 12, 2025
cd37a86
Run github ruff action on PRs only
Jan 12, 2025
3ac73ff
bump version num
Jan 13, 2025
052d927
lint and format
Jan 13, 2025
f5f0580
Ruff with pre-commit (#49)
zsculac Jan 13, 2025
03754a4
Rename variable in constants and remove duplicate functions
Jan 13, 2025
2f7c6c0
PR suggestions
Jan 13, 2025
150e8d7
Rename variable in constants and remove duplicate functions (#50)
zsculac Jan 13, 2025
b744c3b
remove knowledge_collection_address as a param from increase_knowledg…
Jan 13, 2025
0566db0
remove unnecessary param (#51)
zsculac Jan 13, 2025
b65f2fd
Decrease get operation speed + other improvements
Jan 14, 2025
1f13cef
V8 client improvements (#53)
zsculac Jan 15, 2025
ae1d59c
Added publish finality
ilijaMar Jan 16, 2025
10199e6
Added comment to demo.py
ilijaMar Jan 16, 2025
4d4e245
Added publish finality to demo
ilijaMar Jan 16, 2025
5c5c676
Added options to create
ilijaMar Jan 16, 2025
4738923
Removed content type from create
ilijaMar Jan 16, 2025
cbb3180
Added config and added python-dotenv to dependecies
ilijaMar Jan 16, 2025
3329e23
merge sync and async client
Jan 17, 2025
a4109cd
update async demo
Jan 17, 2025
219c1ae
Update project structure
Jan 17, 2025
ba052be
Reorganize project structure
Jan 17, 2025
386b22c
Remove sync modules from async client
Jan 17, 2025
32db848
PR suggestions
Jan 17, 2025
9008281
Add async blokchain service
Jan 17, 2025
ef20670
Fixes
Jan 17, 2025
3cdf84b
Add sync blockchain service
Jan 17, 2025
6575ba1
fixes
Jan 17, 2025
30c970b
Code review
ilijaMar Jan 17, 2025
704363e
Adding publish finality (#54)
ilijaMar Jan 17, 2025
00c7062
Finality fix, graph create/get bind
Jan 17, 2025
01b2960
Merge branch 'v8/develop' into v8/sync-and-async-client
Jan 17, 2025
1144dd8
Rename ask to confirmations_count
Jan 17, 2025
0a09f47
V8 sync and async client (#55)
zsculac Jan 17, 2025
03fb0b0
version bump
Jan 17, 2025
a77e7bb
Ressurect sigma boy
Jan 17, 2025
fc64d72
Add author
Jan 17, 2025
9a9f64f
version bump (#56)
zsculac Jan 17, 2025
6532101
version bumo
Jan 20, 2025
758f1ef
version bump (#57)
zsculac Jan 21, 2025
01094f8
paranet demo update
BogBogdan Jan 21, 2025
ff60003
Names of functions changed in blockchain_request
BogBogdan Jan 22, 2025
f6a357c
Changed names 2
BogBogdan Jan 22, 2025
4e7b1be
fix KA
BogBogdan Jan 22, 2025
67c9e45
minor fixes
BogBogdan Jan 22, 2025
44ba2c2
paranet demo update (#58)
zsculac Jan 23, 2025
4aa22e0
Add new query endpoint
Feb 7, 2025
daf423d
Update async query
Feb 7, 2025
4c8a1bc
bug fixes
Mar 20, 2025
3e24eb8
formatter
Mar 20, 2025
18a91cf
version bump
Mar 20, 2025
0047e8a
Add direct query (#62)
zsculac Mar 20, 2025
534a78a
Fix publish fail due to token amount being too low
Mar 20, 2025
e9cbf74
Fix publish fail due to token amount being too low (#66)
zsculac Mar 20, 2025
ed48fa7
Add new nw testnet hub and bump version
Apr 9, 2025
62611b6
Add new nw testnet hub (#67)
zsculac Apr 9, 2025
643d006
fixed \b \n \f \r \t escape characters
marko03kostic Apr 29, 2025
2742441
added run-async-demo make command
marko03kostic Apr 29, 2025
2f7bb9f
support for utf-8 chars publishing
marko03kostic Apr 29, 2025
2c8a307
chunks handled correctly
marko03kostic Apr 30, 2025
5d75715
' fix
marko03kostic Apr 30, 2025
6797f20
json.dumps fix in demo
marko03kostic Apr 30, 2025
ffbf25c
ensuring utf-8 encoding in response
marko03kostic Apr 30, 2025
c4eaa66
added both \a and \v to the escape map
marko03kostic May 1, 2025
05d19cb
version bump
marko03kostic May 5, 2025
ce9a18c
moved the map into constants
marko03kostic May 5, 2025
36620ed
encoding fix for async graph
marko03kostic May 5, 2025
bc2bc5e
removal of headers
marko03kostic May 6, 2025
ebea626
version bump to 8.0.11
marko03kostic May 6, 2025
d75c539
ensure ascii off in demo
marko03kostic May 6, 2025
44f4c50
Escape char fix (#68)
marko03kostic May 6, 2025
6ce8f16
remove devnet
May 9, 2025
3d7de2d
add example in .env.example
May 9, 2025
2a8e760
improve Makefile
May 9, 2025
cbd78b8
Get environment from blockchainId
May 9, 2025
aa41a45
bump version
May 9, 2025
160e371
Get environment from blockchainId (#69)
zsculac May 9, 2025
03e6ff2
replaced Graph with Dataset, so nquads are parsed properly
marko03kostic May 16, 2025
c2789b2
raise error for invalid jsonld data
marko03kostic May 19, 2025
26b8a7f
fix in rewrite
marko03kostic May 19, 2025
f7093ac
naming convention fix, and added com
marko03kostic May 19, 2025
051c03b
Blank node replace fix (#71)
marko03kostic May 19, 2025
aa1f4f8
version bump to 8.0.13
marko03kostic May 19, 2025
a2d6d68
version bump to 8.0.13 (#72)
marko03kostic May 19, 2025
8ae055d
added test infrastructure
marko03kostic Jun 2, 2025
04def9b
created kc-tools unit tests
marko03kostic Jun 2, 2025
20fe95d
deleted .gitkeep (rename)
marko03kostic Jun 2, 2025
7c91c6d
add github actions
Bojan131 Jun 2, 2025
49f4b1a
Update github actions tests
Bojan131 Jun 2, 2025
4f21781
fixed language and type support for nquads
marko03kostic Jun 3, 2025
fa32d95
added groupNquadsBySubject tests cases
marko03kostic Jun 3, 2025
4650c4d
Merge remote-tracking branch 'origin/improvement/test-infrastructure'…
marko03kostic Jun 3, 2025
7919d9c
emoji test case added
marko03kostic Jun 3, 2025
74ea9f2
updated groupBySubject and blank node tests
marko03kostic Jun 5, 2025
b739d5a
version bump to 8.0.14
marko03kostic Jun 5, 2025
049454a
Test infrastrucutre and kc-tools unit tests (#73)
marko03kostic Jun 6, 2025
5ba6a04
main logic refined
marko03kostic Jun 17, 2025
32ad8dc
main logic refined async
marko03kostic Jun 17, 2025
d24b487
Feature/estimate publish cost (#74)
marko03kostic Jun 26, 2025
6e94a60
bump version
Jun 26, 2025
3843501
bump version (#75)
zsculac Jun 26, 2025
74029f9
added calculate merkle root test
marko03kostic Jul 4, 2025
a3fe9b8
sorted inner arrays aswell
marko03kostic Jul 7, 2025
e949ee6
updated abis
marko03kostic Jul 7, 2025
6e15c99
version bump to 8.1.0rc1
marko03kostic Jul 7, 2025
12648bc
version bump to 8.1.1rc1*
marko03kostic Jul 7, 2025
5327e28
updated abis (#82)
marko03kostic Jul 7, 2025
a3ba52d
sorted inner arrays aswell, fix GET issue (#81)
marko03kostic Jul 7, 2025
a0d1520
added calculate merkle root test (#79)
marko03kostic Jul 7, 2025
288bf0a
fixed metadata not being fetched
marko03kostic Jul 8, 2025
ee17c98
fixed async metadata not being fetched
marko03kostic Jul 8, 2025
a2ac1aa
Fix/metadata (#83)
marko03kostic Jul 10, 2025
1d187ed
version bump
marko03kostic Jul 10, 2025
ae9f961
version bump (#84)
marko03kostic Jul 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PRIVATE_KEY=
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
32 changes: 32 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python Tests

on:
push:
branches: ["**"]
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install dependencies
run: |
poetry install

- name: Run tests
run: |
poetry run make run-test
8 changes: 8 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Ruff
on: [pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dmypy.json

# Pyre type checker
.pyre/
.report
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.4
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: install, run-demo, ruff, help

install:
poetry install
pre-commit install

demo:
python3 examples/demo.py

async-demo:
python3 examples/async_demo.py

paranet-demo:
python3 examples/paranets_demo.py

ruff:
ruff check --fix
ruff format

run-test:
pytest

help:
@echo "Available commands:"
@echo " install - Install dependencies and set up pre-commit hooks"
@echo " ruff - Format code and fix linting issues using ruff"
@echo " run-test - Run tests"
@echo " demo - Run /examples/demo.py file"
@echo " async-demo - Run /examples/async_demo.py file"
@echo " paranet-demo - Run /examples/paranets_demo.py file"
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a name="readme-top"></a>

___
---

<br />
<div align="center">
Expand Down Expand Up @@ -51,7 +51,7 @@ ___
</ol>
</details>

___
---

<br/>

Expand All @@ -61,6 +61,7 @@ ___
<summary>

### **What is the Decentralized Knowledge Graph?**

</summary>

<br/>
Expand All @@ -70,31 +71,35 @@ ___
</div>

OriginTrail Decentralized Knowledge Graph (DKG), hosted on the OriginTrail Decentralized Network (ODN) as trusted knowledge infrastructure, is shared global Knowledge Graph of Knowledge Assets. Running on the basis of the permissionless multi-chain OriginTrail protocol, it combines blockchains and knowledge graph technology to enable trusted AI applications based on key W3C standards.

</details>

<details open>
<summary>

### **The OriginTrail DKG Architecture**

</summary>

<br/>

The OriginTrail tech stack is a three layer structure, consisting of the multi-chain consensus layer (OriginTrail layer 1, running on multiple blockchains), the Decentralized Knowledge Graph layer (OriginTrail Layer 2, hosted on the ODN) and Trusted Knowledge applications in the application layer.
The OriginTrail tech stack is a three layer structure, consisting of the multi-chain consensus layer (OriginTrail layer 1, running on multiple blockchains), the Decentralized Knowledge Graph layer (OriginTrail Layer 2, hosted on the ODN) and Trusted Knowledge applications in the application layer.

<div align="center">
<img src="images/dkg-architecture.png" alt="DKG Architecture" width="400">
</div>

Further, the architecture differentiates between **the public, replicated knowledge graph** shared by all network nodes according to the protocol, and **private Knowledge graphs** hosted separately by each of the OriginTrail nodes.

**Anyone can run an OriginTrail node and become part of the ODN, contributing to the network capacity and hosting the OriginTrail DKG. The OriginTrail node is the ultimate data service for data and knowledge intensive Web3 applications and is used as the key backbone for trusted AI applications (see https://chatdkg.ai)**
**Anyone can run an OriginTrail node and become part of the ODN, contributing to the network capacity and hosting the OriginTrail DKG. The OriginTrail node is the ultimate data service for data and knowledge intensive Web3 applications and is used as the key backbone for trusted AI applications (see https://chatdkg.ai)**

</details>

<details open>
<summary>

### **What is a Knowledge Asset?**

</summary>

<br/>
Expand All @@ -106,15 +111,16 @@ Further, the architecture differentiates between **the public, replicated knowle
**Knowledge Asset is the new, AI‑ready resource for the Internet**

Knowledge Assets are verifiable containers of structured knowledge that live on the OriginTrail DKG and provide:

- **Discoverability - UAL is the new URL**. Uniform Asset Locators (UALs, based on the W3C Decentralized Identifiers) are a new Web3 knowledge identifier (extensions of the Uniform Resource Locators - URLs) which identify a specific piece of knowledge and make it easy to find and connect with other Knowledge Assets.
- **Ownership - NFTs enable ownership**. Each Knowledge Asset contains an NFT token that enables ownership, knowledge asset administration and market mechanisms.
- **Verifiability - On-chain information origin and verifiable trail**. The blockchain tech increases trust, security, transparency, and the traceability of information.


By their nature, Knowledge Assets are semantic resources (following the W3C Semantic Web set of standards), and through their symbolic representations inherently AI ready. See more at https://chatdkg.ai
<br/>

**Discover Knowledge Assets with the DKG Explorer:**

<div align="center">
<table>
<tr>
Expand Down Expand Up @@ -146,48 +152,50 @@ By their nature, Knowledge Assets are semantic resources (following the W3C Sema
</table>
</div>


</details>

<p align="right">(<a href="#readme-top">back to top</a>)</p>
<br/>

## 🚀 Getting Started

___
---

### Prerequisites

* python `>=3.10`
* poetry `>=1.5.1`

- python `>=3.10`
- poetry `>=1.5.1`

In order to use in the local environment, make sure to [run the local DKG network](https://github.com/OriginTrail/ot-node?tab=readme-ov-file#local-network-setup).

___
---

<br/>

### Installation


Create virtual environment (you can choose any existing folder this command will create configurations and virtual env for python):

```bash
python3 -m venv /path/to/folder
```

Inside of previously generated folder you will find activate script in bin folder and run it:

```bash
source /path/to/folder/bin/activate
```

Install dependencies:
Install dependencies and configure pre-commit hooks:

```bash
poetry install
make install
```

Now you can run a demo example file (you need to have the local DKG network running):

```bash
python3 examples/demo.py
make run-demo
```

<br/>
Expand Down Expand Up @@ -228,7 +236,6 @@ Don't forget to give the project a star! Thanks again!

- [web3.py](https://github.com/ethereum/web3.py): Basis for this project


<br/>
<p align="right">(<a href="#readme-top">back to top</a>)</p>

Expand Down Expand Up @@ -263,4 +270,4 @@ Don't forget to give the project a star! Thanks again!
</a>
</div>

___
---
2 changes: 1 addition & 1 deletion dkg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from . import providers # NOQA: F401
from . import utils # NOQA: F401
from .main import DKG # NOQA: F401
from .clients import DKG, AsyncDKG # NOQA: F401
4 changes: 2 additions & 2 deletions dkg/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

from typing import Literal

from dkg.manager import DefaultRequestManager
from dkg.module import Module
from dkg.managers.manager import DefaultRequestManager
from dkg.modules.module import Module
from dkg.types import JSONLD, HexStr
from dkg.utils.merkle import MerkleTree, hash_assertion_with_indexes
from dkg.utils.metadata import generate_assertion_metadata
Expand Down
Loading