vbase-api 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vbase_api-0.1.2/PKG-INFO +84 -0
- vbase_api-0.1.2/README.md +66 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/pyproject.toml +4 -2
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api/__init__.py +2 -0
- vbase_api-0.1.2/src/vbase_api/_version.py +1 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api/vbase_api_client.py +2 -0
- vbase_api-0.1.2/src/vbase_api.egg-info/PKG-INFO +84 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api.egg-info/SOURCES.txt +1 -0
- vbase_api-0.1.1/PKG-INFO +0 -333
- vbase_api-0.1.1/README.md +0 -315
- vbase_api-0.1.1/src/vbase_api.egg-info/PKG-INFO +0 -333
- {vbase_api-0.1.1 → vbase_api-0.1.2}/LICENSE.txt +0 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/NOTICE.txt +0 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/setup.cfg +0 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api/vbase_api_models.py +0 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api.egg-info/dependency_links.txt +0 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api.egg-info/requires.txt +0 -0
- {vbase_api-0.1.1 → vbase_api-0.1.2}/src/vbase_api.egg-info/top_level.txt +0 -0
vbase_api-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vbase-api
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: vBase REST API Python Client
|
|
5
|
+
Author-email: vBase <tech@vbase.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/validityBase/vbase-api-py
|
|
8
|
+
Project-URL: Documentation, https://docs.vbase.com/
|
|
9
|
+
Keywords: vbase,stamping,web3,blockchain,validation
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE.txt
|
|
15
|
+
License-File: NOTICE.txt
|
|
16
|
+
Requires-Dist: requests>=2.7.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# vbase-py
|
|
20
|
+
|
|
21
|
+
vBase REST API Python Client
|
|
22
|
+
|
|
23
|
+
See [documentation](https://docs.vbase.com/) and the [Swagger UI](https://app.vbase.com/swagger/) for more details.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
|
30
|
+
|
|
31
|
+
## Introduction
|
|
32
|
+
|
|
33
|
+
vBase creates a global auditable record of when data was created, by whom, and how it has changed (collectively, “data provenance”). Data producers can prove the provenance of their data to any external party, increasing its value and marketability. Data consumers can ensure the integrity of historical data and any derivative calculations. The result is trustworthy information that can be put into production quickly without expensive and time-consuming trials.
|
|
34
|
+
|
|
35
|
+
Verifiable provenance establishes the credibility of data and calculations. For example, if you wish to prove investment skill, the recipient must be sure they are receiving a complete and accurate record of your timestamped trades or portfolios.
|
|
36
|
+
|
|
37
|
+
vBase resolves several expensive market failures common to financial data. Some of the areas that benefit include:
|
|
38
|
+
- Provably point-in-time datasets
|
|
39
|
+
- Auditable investing track records
|
|
40
|
+
- Sound backtests, historical simulations, and time-series modeling
|
|
41
|
+
|
|
42
|
+
vBase services do not require access to the data itself, assuring privacy. They also do not rely on centralized intermediaries, eliminating the technical, operating, and business risks of a trusted party controlling your data and its validation. vBase ensures data security and interoperability that is unattainable with legacy centralized systems. It does so by storing digital fingerprints of data, metadata, and revisions on secure public blockchains.
|
|
43
|
+
|
|
44
|
+
With vBase, creating and consuming provably correct data is as easy as pressing a button.
|
|
45
|
+
|
|
46
|
+
## References
|
|
47
|
+
- [vBase Website](https://vbase.com)
|
|
48
|
+
- [vBase Documentation](https://docs.vbase.com/)
|
|
49
|
+
- [vBase Swagger UI](https://app.vbase.com/swagger/)
|
|
50
|
+
- [vBase API Python Client Issues](https://github.com/validityBase/vbase-api-py/issues)
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
Install the package using pip:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install vbase-api
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
### Getting Your API Key
|
|
63
|
+
|
|
64
|
+
To use the vBase API, you'll need an API key (Bearer token). You can obtain this from your [vBase account settings](https://app.vbase.com/profile#account_settings).
|
|
65
|
+
|
|
66
|
+
### Basic Usage
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from vbase_api import VBaseAPIClient
|
|
70
|
+
|
|
71
|
+
# Initialize the client
|
|
72
|
+
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
73
|
+
|
|
74
|
+
# Stamp some data
|
|
75
|
+
stamp = client.create_stamp(data="Important data to be stamped")
|
|
76
|
+
print(f"Stamped with CID: {stamp.commitment_receipt.object_cid}")
|
|
77
|
+
|
|
78
|
+
# List your collections
|
|
79
|
+
collections = client.get_collections()
|
|
80
|
+
for collection in collections:
|
|
81
|
+
print(f"{collection.name}: {collection.cid}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# vbase-py
|
|
2
|
+
|
|
3
|
+
vBase REST API Python Client
|
|
4
|
+
|
|
5
|
+
See [documentation](https://docs.vbase.com/) and the [Swagger UI](https://app.vbase.com/swagger/) for more details.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
|
12
|
+
|
|
13
|
+
## Introduction
|
|
14
|
+
|
|
15
|
+
vBase creates a global auditable record of when data was created, by whom, and how it has changed (collectively, “data provenance”). Data producers can prove the provenance of their data to any external party, increasing its value and marketability. Data consumers can ensure the integrity of historical data and any derivative calculations. The result is trustworthy information that can be put into production quickly without expensive and time-consuming trials.
|
|
16
|
+
|
|
17
|
+
Verifiable provenance establishes the credibility of data and calculations. For example, if you wish to prove investment skill, the recipient must be sure they are receiving a complete and accurate record of your timestamped trades or portfolios.
|
|
18
|
+
|
|
19
|
+
vBase resolves several expensive market failures common to financial data. Some of the areas that benefit include:
|
|
20
|
+
- Provably point-in-time datasets
|
|
21
|
+
- Auditable investing track records
|
|
22
|
+
- Sound backtests, historical simulations, and time-series modeling
|
|
23
|
+
|
|
24
|
+
vBase services do not require access to the data itself, assuring privacy. They also do not rely on centralized intermediaries, eliminating the technical, operating, and business risks of a trusted party controlling your data and its validation. vBase ensures data security and interoperability that is unattainable with legacy centralized systems. It does so by storing digital fingerprints of data, metadata, and revisions on secure public blockchains.
|
|
25
|
+
|
|
26
|
+
With vBase, creating and consuming provably correct data is as easy as pressing a button.
|
|
27
|
+
|
|
28
|
+
## References
|
|
29
|
+
- [vBase Website](https://vbase.com)
|
|
30
|
+
- [vBase Documentation](https://docs.vbase.com/)
|
|
31
|
+
- [vBase Swagger UI](https://app.vbase.com/swagger/)
|
|
32
|
+
- [vBase API Python Client Issues](https://github.com/validityBase/vbase-api-py/issues)
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Install the package using pip:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install vbase-api
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### Getting Your API Key
|
|
45
|
+
|
|
46
|
+
To use the vBase API, you'll need an API key (Bearer token). You can obtain this from your [vBase account settings](https://app.vbase.com/profile#account_settings).
|
|
47
|
+
|
|
48
|
+
### Basic Usage
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from vbase_api import VBaseAPIClient
|
|
52
|
+
|
|
53
|
+
# Initialize the client
|
|
54
|
+
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
55
|
+
|
|
56
|
+
# Stamp some data
|
|
57
|
+
stamp = client.create_stamp(data="Important data to be stamped")
|
|
58
|
+
print(f"Stamped with CID: {stamp.commitment_receipt.object_cid}")
|
|
59
|
+
|
|
60
|
+
# List your collections
|
|
61
|
+
collections = client.get_collections()
|
|
62
|
+
for collection in collections:
|
|
63
|
+
print(f"{collection.name}: {collection.cid}")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "vbase-api" # This is the name on PyPI
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "vBase REST API Python Client"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -31,6 +31,8 @@ Documentation = "https://docs.vbase.com/"
|
|
|
31
31
|
package-dir = {"" = "src"}
|
|
32
32
|
|
|
33
33
|
[tool.setuptools.packages.find]
|
|
34
|
-
|
|
35
34
|
where = ["src"]
|
|
36
35
|
|
|
36
|
+
[tool.setuptools.dynamic]
|
|
37
|
+
version = {attr = "vbase_api._version.__version__"}
|
|
38
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# src/simplemath/__init__.py
|
|
2
2
|
|
|
3
|
+
from ._version import __version__
|
|
3
4
|
from .vbase_api_client import VBaseAPIError, VBaseAPIClient
|
|
4
5
|
from .vbase_api_models import (
|
|
5
6
|
Collection,
|
|
@@ -10,6 +11,7 @@ from .vbase_api_models import (
|
|
|
10
11
|
)
|
|
11
12
|
|
|
12
13
|
__all__ = [
|
|
14
|
+
"__version__",
|
|
13
15
|
"VBaseAPIClient",
|
|
14
16
|
"VBaseAPIError",
|
|
15
17
|
"Collection",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.2"
|
|
@@ -13,6 +13,7 @@ import requests
|
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from typing import Dict, List, Optional, Any, BinaryIO, Union
|
|
15
15
|
|
|
16
|
+
from ._version import __version__
|
|
16
17
|
from .vbase_api_models import (
|
|
17
18
|
Collection,
|
|
18
19
|
StampCreatedResponse,
|
|
@@ -69,6 +70,7 @@ class VBaseAPIClient:
|
|
|
69
70
|
self.session = requests.Session()
|
|
70
71
|
self.session.headers.update({
|
|
71
72
|
'Authorization': f'Bearer {api_key}',
|
|
73
|
+
'User-Agent': f'vBase API Python Client v{__version__}',
|
|
72
74
|
})
|
|
73
75
|
|
|
74
76
|
def _get_url(self, endpoint: str) -> str:
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vbase-api
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: vBase REST API Python Client
|
|
5
|
+
Author-email: vBase <tech@vbase.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/validityBase/vbase-api-py
|
|
8
|
+
Project-URL: Documentation, https://docs.vbase.com/
|
|
9
|
+
Keywords: vbase,stamping,web3,blockchain,validation
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE.txt
|
|
15
|
+
License-File: NOTICE.txt
|
|
16
|
+
Requires-Dist: requests>=2.7.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# vbase-py
|
|
20
|
+
|
|
21
|
+
vBase REST API Python Client
|
|
22
|
+
|
|
23
|
+
See [documentation](https://docs.vbase.com/) and the [Swagger UI](https://app.vbase.com/swagger/) for more details.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
|
30
|
+
|
|
31
|
+
## Introduction
|
|
32
|
+
|
|
33
|
+
vBase creates a global auditable record of when data was created, by whom, and how it has changed (collectively, “data provenance”). Data producers can prove the provenance of their data to any external party, increasing its value and marketability. Data consumers can ensure the integrity of historical data and any derivative calculations. The result is trustworthy information that can be put into production quickly without expensive and time-consuming trials.
|
|
34
|
+
|
|
35
|
+
Verifiable provenance establishes the credibility of data and calculations. For example, if you wish to prove investment skill, the recipient must be sure they are receiving a complete and accurate record of your timestamped trades or portfolios.
|
|
36
|
+
|
|
37
|
+
vBase resolves several expensive market failures common to financial data. Some of the areas that benefit include:
|
|
38
|
+
- Provably point-in-time datasets
|
|
39
|
+
- Auditable investing track records
|
|
40
|
+
- Sound backtests, historical simulations, and time-series modeling
|
|
41
|
+
|
|
42
|
+
vBase services do not require access to the data itself, assuring privacy. They also do not rely on centralized intermediaries, eliminating the technical, operating, and business risks of a trusted party controlling your data and its validation. vBase ensures data security and interoperability that is unattainable with legacy centralized systems. It does so by storing digital fingerprints of data, metadata, and revisions on secure public blockchains.
|
|
43
|
+
|
|
44
|
+
With vBase, creating and consuming provably correct data is as easy as pressing a button.
|
|
45
|
+
|
|
46
|
+
## References
|
|
47
|
+
- [vBase Website](https://vbase.com)
|
|
48
|
+
- [vBase Documentation](https://docs.vbase.com/)
|
|
49
|
+
- [vBase Swagger UI](https://app.vbase.com/swagger/)
|
|
50
|
+
- [vBase API Python Client Issues](https://github.com/validityBase/vbase-api-py/issues)
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
Install the package using pip:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install vbase-api
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
### Getting Your API Key
|
|
63
|
+
|
|
64
|
+
To use the vBase API, you'll need an API key (Bearer token). You can obtain this from your [vBase account settings](https://app.vbase.com/profile#account_settings).
|
|
65
|
+
|
|
66
|
+
### Basic Usage
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from vbase_api import VBaseAPIClient
|
|
70
|
+
|
|
71
|
+
# Initialize the client
|
|
72
|
+
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
73
|
+
|
|
74
|
+
# Stamp some data
|
|
75
|
+
stamp = client.create_stamp(data="Important data to be stamped")
|
|
76
|
+
print(f"Stamped with CID: {stamp.commitment_receipt.object_cid}")
|
|
77
|
+
|
|
78
|
+
# List your collections
|
|
79
|
+
collections = client.get_collections()
|
|
80
|
+
for collection in collections:
|
|
81
|
+
print(f"{collection.name}: {collection.cid}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
vbase_api-0.1.1/PKG-INFO
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: vbase-api
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: vBase REST API Python Client
|
|
5
|
-
Author-email: vBase <tech@vbase.com>
|
|
6
|
-
License-Expression: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/validityBase/vbase-api-py
|
|
8
|
-
Project-URL: Documentation, https://docs.vbase.com/
|
|
9
|
-
Keywords: vbase,stamping,web3,blockchain,validation
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.8
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE.txt
|
|
15
|
-
License-File: NOTICE.txt
|
|
16
|
-
Requires-Dist: requests>=2.7.0
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# vbase-py
|
|
20
|
-
|
|
21
|
-
vBase REST API Python Client
|
|
22
|
-
|
|
23
|
-
See [documentation](https://docs.vbase.com/) and the [Swagger UI](https://app.vbase.com/swagger/) for more details.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## License
|
|
28
|
-
|
|
29
|
-
This project is licensed under the Apache 2.0 License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
|
30
|
-
|
|
31
|
-
## Introduction
|
|
32
|
-
|
|
33
|
-
vBase creates a global auditable record of when data was created, by whom, and how it has changed (collectively, “data provenance”). Data producers can prove the provenance of their data to any external party, increasing its value and marketability. Data consumers can ensure the integrity of historical data and any derivative calculations. The result is trustworthy information that can be put into production quickly without expensive and time-consuming trials.
|
|
34
|
-
|
|
35
|
-
Verifiable provenance establishes the credibility of data and calculations. For example, if you wish to prove investment skill, the recipient must be sure they are receiving a complete and accurate record of your timestamped trades or portfolios.
|
|
36
|
-
|
|
37
|
-
vBase resolves several expensive market failures common to financial data. Some of the areas that benefit include:
|
|
38
|
-
- Provably point-in-time datasets
|
|
39
|
-
- Auditable investing track records
|
|
40
|
-
- Sound backtests, historical simulations, and time-series modeling
|
|
41
|
-
|
|
42
|
-
vBase services do not require access to the data itself, assuring privacy. They also do not rely on centralized intermediaries, eliminating the technical, operating, and business risks of a trusted party controlling your data and its validation. vBase ensures data security and interoperability that is unattainable with legacy centralized systems. It does so by storing digital fingerprints of data, metadata, and revisions on secure public blockchains.
|
|
43
|
-
|
|
44
|
-
With vBase, creating and consuming provably correct data is as easy as pressing a button.
|
|
45
|
-
|
|
46
|
-
## Installation
|
|
47
|
-
|
|
48
|
-
Install the package using pip:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
pip install vbase-api
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Quick Start
|
|
55
|
-
|
|
56
|
-
### Getting Your API Key
|
|
57
|
-
|
|
58
|
-
To use the vBase API, you'll need an API key (Bearer token). You can obtain this from your [vBase account settings](https://app.vbase.com/profile#account_settings).
|
|
59
|
-
|
|
60
|
-
### Basic Usage
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
from vbase_api import VBaseAPIClient
|
|
64
|
-
|
|
65
|
-
# Initialize the client
|
|
66
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
67
|
-
|
|
68
|
-
# Stamp some data
|
|
69
|
-
stamp = client.create_stamp(data="Important data to be stamped")
|
|
70
|
-
print(f"Stamped with CID: {stamp.commitment_receipt.object_cid}")
|
|
71
|
-
|
|
72
|
-
# List your collections
|
|
73
|
-
collections = client.get_collections()
|
|
74
|
-
for collection in collections:
|
|
75
|
-
print(f"{collection.name}: {collection.cid}")
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Usage Guide
|
|
79
|
-
|
|
80
|
-
### Creating a Client
|
|
81
|
-
|
|
82
|
-
The `VBaseAPIClient` can be initialized with your API key:
|
|
83
|
-
|
|
84
|
-
```python
|
|
85
|
-
from vbase_api import VBaseAPIClient
|
|
86
|
-
|
|
87
|
-
# Basic initialization
|
|
88
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
89
|
-
|
|
90
|
-
# With custom base URL and timeout
|
|
91
|
-
client = VBaseAPIClient(
|
|
92
|
-
api_key="your-bearer-token",
|
|
93
|
-
base_url="https://app.vbase.com",
|
|
94
|
-
timeout=60
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
# Using context manager (recommended)
|
|
98
|
-
with VBaseAPIClient(api_key="your-bearer-token") as client:
|
|
99
|
-
collections = client.get_collections()
|
|
100
|
-
# Client resources are automatically cleaned up
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Stamping Data
|
|
104
|
-
|
|
105
|
-
The `create_stamp()` method is the core functionality of vBase. It allows you to create a blockchain-verified timestamp of your data.
|
|
106
|
-
|
|
107
|
-
#### Stamp Inline Data
|
|
108
|
-
|
|
109
|
-
```python
|
|
110
|
-
# Stamp text data
|
|
111
|
-
stamp = client.create_stamp(
|
|
112
|
-
data="Important document content"
|
|
113
|
-
)
|
|
114
|
-
print(f"Object CID: {stamp.commitment_receipt.object_cid}")
|
|
115
|
-
print(f"Transaction: {stamp.commitment_receipt.transaction_hash}")
|
|
116
|
-
print(f"Timestamp: {stamp.commitment_receipt.timestamp}")
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### Stamp a File
|
|
121
|
-
|
|
122
|
-
```python
|
|
123
|
-
# Stamp a file from disk
|
|
124
|
-
stamp = client.create_stamp(file="report.pdf")
|
|
125
|
-
|
|
126
|
-
# Stamp a file and add to a collection
|
|
127
|
-
stamp = client.create_stamp(
|
|
128
|
-
file="portfolio.csv",
|
|
129
|
-
collection_name="Investment Records",
|
|
130
|
-
idempotent=False
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
# Access file information
|
|
134
|
-
if stamp.file_object:
|
|
135
|
-
print(f"File: {stamp.file_object.file_name}")
|
|
136
|
-
print(f"Path: {stamp.file_object.file_path}")
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
#### Stamp precalculated CID, without uploading actual data
|
|
140
|
-
|
|
141
|
-
```python
|
|
142
|
-
# Stamp a CID that already exists
|
|
143
|
-
stamp = client.create_stamp(
|
|
144
|
-
data_cid="0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201",
|
|
145
|
-
collection_name="My Collection"
|
|
146
|
-
)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Working with Collections
|
|
150
|
-
|
|
151
|
-
Collections help organize your stamped data into logical groups.
|
|
152
|
-
|
|
153
|
-
#### List Collections
|
|
154
|
-
|
|
155
|
-
```python
|
|
156
|
-
# Get all collections
|
|
157
|
-
collections = client.get_collections()
|
|
158
|
-
for collection in collections:
|
|
159
|
-
print(f"{collection.name} - {collection.description}")
|
|
160
|
-
|
|
161
|
-
# Filter by pinned status
|
|
162
|
-
pinned_collections = client.get_collections(is_pinned=True)
|
|
163
|
-
|
|
164
|
-
# Filter by user address
|
|
165
|
-
user_collections = client.get_collections(user_address="0x...")
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
#### Create a Collection
|
|
169
|
-
|
|
170
|
-
```python
|
|
171
|
-
collection = client.create_collection(
|
|
172
|
-
name="Investment Track Records",
|
|
173
|
-
description="Auditable portfolio holdings and trades"
|
|
174
|
-
)
|
|
175
|
-
print(f"Created collection: {collection.name}")
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Verifying Stamps
|
|
179
|
-
|
|
180
|
-
Verify that specific CIDs have been stamped on the blockchain.
|
|
181
|
-
|
|
182
|
-
```python
|
|
183
|
-
# Verify one or more CIDs
|
|
184
|
-
result = client.verify_stamps(
|
|
185
|
-
cids=[
|
|
186
|
-
"0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201",
|
|
187
|
-
"0xcd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893202"
|
|
188
|
-
]
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
# Check results
|
|
192
|
-
print(f"Timezone: {result.display_timezone}")
|
|
193
|
-
for stamp in result.stamp_list:
|
|
194
|
-
print(f"Found stamp:")
|
|
195
|
-
print(f" CID: {stamp.object_cid}")
|
|
196
|
-
print(f" Timestamp: {stamp.timestamp}")
|
|
197
|
-
print(f" Transaction: {stamp.transaction_hash}")
|
|
198
|
-
print(f" User: {stamp.user_address}")
|
|
199
|
-
|
|
200
|
-
# Verify CIDs for current user only
|
|
201
|
-
result = client.verify_stamps(
|
|
202
|
-
cids=["0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201"],
|
|
203
|
-
filter_by_user=True
|
|
204
|
-
)
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Upload Previously Stamped Files
|
|
208
|
-
|
|
209
|
-
Upload a file that has already been stamped to vBase storage.
|
|
210
|
-
|
|
211
|
-
```python
|
|
212
|
-
result = client.upload_stamped_file(
|
|
213
|
-
collection_name="Investment Records",
|
|
214
|
-
file="previously_stamped.pdf"
|
|
215
|
-
)
|
|
216
|
-
print(f"Uploaded: {result.file_object.file_name}")
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### User Account Information
|
|
220
|
-
|
|
221
|
-
```python
|
|
222
|
-
# Get current user information
|
|
223
|
-
user = client.get_current_user()
|
|
224
|
-
print(f"Email: {user.email}")
|
|
225
|
-
print(f"Name: {user.name}")
|
|
226
|
-
print(f"Timezone: {user.display_timezone}")
|
|
227
|
-
print(f"Address: {user.last_address}")
|
|
228
|
-
|
|
229
|
-
# Get another user's information by address
|
|
230
|
-
other_user = client.get_user("0x1234123412341234123412341234123412341234")
|
|
231
|
-
print(f"User name: {other_user.name}")
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## Error Handling
|
|
235
|
-
|
|
236
|
-
The client raises `VBaseAPIError` for API-related errors:
|
|
237
|
-
|
|
238
|
-
```python
|
|
239
|
-
from vbase_api_py import VBaseAPIClient, VBaseAPIError
|
|
240
|
-
|
|
241
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
242
|
-
|
|
243
|
-
try:
|
|
244
|
-
stamp = client.create_stamp(data={"test": "data"})
|
|
245
|
-
except VBaseAPIError as e:
|
|
246
|
-
print(f"Error: {e.message}")
|
|
247
|
-
if e.status_code:
|
|
248
|
-
print(f"Status code: {e.status_code}")
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## Response Objects
|
|
252
|
-
|
|
253
|
-
The client returns typed response objects for easy data access:
|
|
254
|
-
|
|
255
|
-
- **`StampCreatedResponse`**: Returned when a new stamp is created (201 status)
|
|
256
|
-
- `commitment_receipt`: CommitmentReceipt object
|
|
257
|
-
- `file_object`: FileObject (optional)
|
|
258
|
-
|
|
259
|
-
- **`IdempotentStampResponse`**: Returned when stamp already exists (200 status)
|
|
260
|
-
- `commitment_receipt`: CommitmentReceipt object
|
|
261
|
-
|
|
262
|
-
- **`CommitmentReceipt`**: Blockchain stamp details
|
|
263
|
-
- `transaction_hash`: Blockchain transaction hash
|
|
264
|
-
- `user_address`: User's blockchain address
|
|
265
|
-
- `set_cid`: Set CID (collection)
|
|
266
|
-
- `object_cid`: Object CID (stamped data)
|
|
267
|
-
- `timestamp`: ISO format timestamp
|
|
268
|
-
- `chain_id`: Blockchain chain ID
|
|
269
|
-
|
|
270
|
-
- **`Collection`**: Collection information
|
|
271
|
-
- `id`, `name`, `cid`, `description`
|
|
272
|
-
- `is_pinned`, `is_public`
|
|
273
|
-
- `created_at`
|
|
274
|
-
|
|
275
|
-
- **`AccountSettings`**: User account details
|
|
276
|
-
- `name`, `email`, `persistent_id`
|
|
277
|
-
- `display_timezone`, `date_joined`
|
|
278
|
-
- `last_address`, `last_is_verified`
|
|
279
|
-
|
|
280
|
-
## Complete Example
|
|
281
|
-
|
|
282
|
-
```python
|
|
283
|
-
from vbase_api import VBaseAPIClient, VBaseAPIError
|
|
284
|
-
|
|
285
|
-
def main():
|
|
286
|
-
# Initialize client
|
|
287
|
-
with VBaseAPIClient(api_key="your-bearer-token") as client:
|
|
288
|
-
try:
|
|
289
|
-
# Get user info
|
|
290
|
-
user = client.get_current_user()
|
|
291
|
-
print(f"Authenticated as: {user.email}")
|
|
292
|
-
|
|
293
|
-
# Create a collection
|
|
294
|
-
collection = client.create_collection(
|
|
295
|
-
name="Trading Records",
|
|
296
|
-
cid=None,
|
|
297
|
-
description="Timestamped trading data",
|
|
298
|
-
is_pinned=True
|
|
299
|
-
)
|
|
300
|
-
|
|
301
|
-
# Stamp trading data
|
|
302
|
-
trade_data = {
|
|
303
|
-
"symbol": "AAPL",
|
|
304
|
-
"shares": 100,
|
|
305
|
-
"price": 150.25,
|
|
306
|
-
"timestamp": "2025-11-24T10:30:00Z"
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
stamp = client.create_stamp(
|
|
310
|
-
data=trade_data,
|
|
311
|
-
collection_name="Trading Records"
|
|
312
|
-
)
|
|
313
|
-
|
|
314
|
-
print(f"Trade stamped!")
|
|
315
|
-
print(f" CID: {stamp.commitment_receipt.object_cid}")
|
|
316
|
-
print(f" Transaction: {stamp.commitment_receipt.transaction_hash}")
|
|
317
|
-
print(f" Blockchain timestamp: {stamp.commitment_receipt.timestamp}")
|
|
318
|
-
|
|
319
|
-
# Verify the stamp
|
|
320
|
-
verification = client.verify_stamps(
|
|
321
|
-
cids=[stamp.commitment_receipt.object_cid]
|
|
322
|
-
)
|
|
323
|
-
|
|
324
|
-
if verification.stamp_list:
|
|
325
|
-
print("Stamp verified on blockchain!")
|
|
326
|
-
|
|
327
|
-
except VBaseAPIError as e:
|
|
328
|
-
print(f"API Error: {e}")
|
|
329
|
-
|
|
330
|
-
if __name__ == "__main__":
|
|
331
|
-
main()
|
|
332
|
-
```
|
|
333
|
-
|
vbase_api-0.1.1/README.md
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
# vbase-py
|
|
2
|
-
|
|
3
|
-
vBase REST API Python Client
|
|
4
|
-
|
|
5
|
-
See [documentation](https://docs.vbase.com/) and the [Swagger UI](https://app.vbase.com/swagger/) for more details.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## License
|
|
10
|
-
|
|
11
|
-
This project is licensed under the Apache 2.0 License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
|
12
|
-
|
|
13
|
-
## Introduction
|
|
14
|
-
|
|
15
|
-
vBase creates a global auditable record of when data was created, by whom, and how it has changed (collectively, “data provenance”). Data producers can prove the provenance of their data to any external party, increasing its value and marketability. Data consumers can ensure the integrity of historical data and any derivative calculations. The result is trustworthy information that can be put into production quickly without expensive and time-consuming trials.
|
|
16
|
-
|
|
17
|
-
Verifiable provenance establishes the credibility of data and calculations. For example, if you wish to prove investment skill, the recipient must be sure they are receiving a complete and accurate record of your timestamped trades or portfolios.
|
|
18
|
-
|
|
19
|
-
vBase resolves several expensive market failures common to financial data. Some of the areas that benefit include:
|
|
20
|
-
- Provably point-in-time datasets
|
|
21
|
-
- Auditable investing track records
|
|
22
|
-
- Sound backtests, historical simulations, and time-series modeling
|
|
23
|
-
|
|
24
|
-
vBase services do not require access to the data itself, assuring privacy. They also do not rely on centralized intermediaries, eliminating the technical, operating, and business risks of a trusted party controlling your data and its validation. vBase ensures data security and interoperability that is unattainable with legacy centralized systems. It does so by storing digital fingerprints of data, metadata, and revisions on secure public blockchains.
|
|
25
|
-
|
|
26
|
-
With vBase, creating and consuming provably correct data is as easy as pressing a button.
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
Install the package using pip:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pip install vbase-api
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Quick Start
|
|
37
|
-
|
|
38
|
-
### Getting Your API Key
|
|
39
|
-
|
|
40
|
-
To use the vBase API, you'll need an API key (Bearer token). You can obtain this from your [vBase account settings](https://app.vbase.com/profile#account_settings).
|
|
41
|
-
|
|
42
|
-
### Basic Usage
|
|
43
|
-
|
|
44
|
-
```python
|
|
45
|
-
from vbase_api import VBaseAPIClient
|
|
46
|
-
|
|
47
|
-
# Initialize the client
|
|
48
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
49
|
-
|
|
50
|
-
# Stamp some data
|
|
51
|
-
stamp = client.create_stamp(data="Important data to be stamped")
|
|
52
|
-
print(f"Stamped with CID: {stamp.commitment_receipt.object_cid}")
|
|
53
|
-
|
|
54
|
-
# List your collections
|
|
55
|
-
collections = client.get_collections()
|
|
56
|
-
for collection in collections:
|
|
57
|
-
print(f"{collection.name}: {collection.cid}")
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Usage Guide
|
|
61
|
-
|
|
62
|
-
### Creating a Client
|
|
63
|
-
|
|
64
|
-
The `VBaseAPIClient` can be initialized with your API key:
|
|
65
|
-
|
|
66
|
-
```python
|
|
67
|
-
from vbase_api import VBaseAPIClient
|
|
68
|
-
|
|
69
|
-
# Basic initialization
|
|
70
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
71
|
-
|
|
72
|
-
# With custom base URL and timeout
|
|
73
|
-
client = VBaseAPIClient(
|
|
74
|
-
api_key="your-bearer-token",
|
|
75
|
-
base_url="https://app.vbase.com",
|
|
76
|
-
timeout=60
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
# Using context manager (recommended)
|
|
80
|
-
with VBaseAPIClient(api_key="your-bearer-token") as client:
|
|
81
|
-
collections = client.get_collections()
|
|
82
|
-
# Client resources are automatically cleaned up
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Stamping Data
|
|
86
|
-
|
|
87
|
-
The `create_stamp()` method is the core functionality of vBase. It allows you to create a blockchain-verified timestamp of your data.
|
|
88
|
-
|
|
89
|
-
#### Stamp Inline Data
|
|
90
|
-
|
|
91
|
-
```python
|
|
92
|
-
# Stamp text data
|
|
93
|
-
stamp = client.create_stamp(
|
|
94
|
-
data="Important document content"
|
|
95
|
-
)
|
|
96
|
-
print(f"Object CID: {stamp.commitment_receipt.object_cid}")
|
|
97
|
-
print(f"Transaction: {stamp.commitment_receipt.transaction_hash}")
|
|
98
|
-
print(f"Timestamp: {stamp.commitment_receipt.timestamp}")
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
#### Stamp a File
|
|
103
|
-
|
|
104
|
-
```python
|
|
105
|
-
# Stamp a file from disk
|
|
106
|
-
stamp = client.create_stamp(file="report.pdf")
|
|
107
|
-
|
|
108
|
-
# Stamp a file and add to a collection
|
|
109
|
-
stamp = client.create_stamp(
|
|
110
|
-
file="portfolio.csv",
|
|
111
|
-
collection_name="Investment Records",
|
|
112
|
-
idempotent=False
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
# Access file information
|
|
116
|
-
if stamp.file_object:
|
|
117
|
-
print(f"File: {stamp.file_object.file_name}")
|
|
118
|
-
print(f"Path: {stamp.file_object.file_path}")
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
#### Stamp precalculated CID, without uploading actual data
|
|
122
|
-
|
|
123
|
-
```python
|
|
124
|
-
# Stamp a CID that already exists
|
|
125
|
-
stamp = client.create_stamp(
|
|
126
|
-
data_cid="0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201",
|
|
127
|
-
collection_name="My Collection"
|
|
128
|
-
)
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Working with Collections
|
|
132
|
-
|
|
133
|
-
Collections help organize your stamped data into logical groups.
|
|
134
|
-
|
|
135
|
-
#### List Collections
|
|
136
|
-
|
|
137
|
-
```python
|
|
138
|
-
# Get all collections
|
|
139
|
-
collections = client.get_collections()
|
|
140
|
-
for collection in collections:
|
|
141
|
-
print(f"{collection.name} - {collection.description}")
|
|
142
|
-
|
|
143
|
-
# Filter by pinned status
|
|
144
|
-
pinned_collections = client.get_collections(is_pinned=True)
|
|
145
|
-
|
|
146
|
-
# Filter by user address
|
|
147
|
-
user_collections = client.get_collections(user_address="0x...")
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### Create a Collection
|
|
151
|
-
|
|
152
|
-
```python
|
|
153
|
-
collection = client.create_collection(
|
|
154
|
-
name="Investment Track Records",
|
|
155
|
-
description="Auditable portfolio holdings and trades"
|
|
156
|
-
)
|
|
157
|
-
print(f"Created collection: {collection.name}")
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Verifying Stamps
|
|
161
|
-
|
|
162
|
-
Verify that specific CIDs have been stamped on the blockchain.
|
|
163
|
-
|
|
164
|
-
```python
|
|
165
|
-
# Verify one or more CIDs
|
|
166
|
-
result = client.verify_stamps(
|
|
167
|
-
cids=[
|
|
168
|
-
"0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201",
|
|
169
|
-
"0xcd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893202"
|
|
170
|
-
]
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
# Check results
|
|
174
|
-
print(f"Timezone: {result.display_timezone}")
|
|
175
|
-
for stamp in result.stamp_list:
|
|
176
|
-
print(f"Found stamp:")
|
|
177
|
-
print(f" CID: {stamp.object_cid}")
|
|
178
|
-
print(f" Timestamp: {stamp.timestamp}")
|
|
179
|
-
print(f" Transaction: {stamp.transaction_hash}")
|
|
180
|
-
print(f" User: {stamp.user_address}")
|
|
181
|
-
|
|
182
|
-
# Verify CIDs for current user only
|
|
183
|
-
result = client.verify_stamps(
|
|
184
|
-
cids=["0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201"],
|
|
185
|
-
filter_by_user=True
|
|
186
|
-
)
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Upload Previously Stamped Files
|
|
190
|
-
|
|
191
|
-
Upload a file that has already been stamped to vBase storage.
|
|
192
|
-
|
|
193
|
-
```python
|
|
194
|
-
result = client.upload_stamped_file(
|
|
195
|
-
collection_name="Investment Records",
|
|
196
|
-
file="previously_stamped.pdf"
|
|
197
|
-
)
|
|
198
|
-
print(f"Uploaded: {result.file_object.file_name}")
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### User Account Information
|
|
202
|
-
|
|
203
|
-
```python
|
|
204
|
-
# Get current user information
|
|
205
|
-
user = client.get_current_user()
|
|
206
|
-
print(f"Email: {user.email}")
|
|
207
|
-
print(f"Name: {user.name}")
|
|
208
|
-
print(f"Timezone: {user.display_timezone}")
|
|
209
|
-
print(f"Address: {user.last_address}")
|
|
210
|
-
|
|
211
|
-
# Get another user's information by address
|
|
212
|
-
other_user = client.get_user("0x1234123412341234123412341234123412341234")
|
|
213
|
-
print(f"User name: {other_user.name}")
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Error Handling
|
|
217
|
-
|
|
218
|
-
The client raises `VBaseAPIError` for API-related errors:
|
|
219
|
-
|
|
220
|
-
```python
|
|
221
|
-
from vbase_api_py import VBaseAPIClient, VBaseAPIError
|
|
222
|
-
|
|
223
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
224
|
-
|
|
225
|
-
try:
|
|
226
|
-
stamp = client.create_stamp(data={"test": "data"})
|
|
227
|
-
except VBaseAPIError as e:
|
|
228
|
-
print(f"Error: {e.message}")
|
|
229
|
-
if e.status_code:
|
|
230
|
-
print(f"Status code: {e.status_code}")
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Response Objects
|
|
234
|
-
|
|
235
|
-
The client returns typed response objects for easy data access:
|
|
236
|
-
|
|
237
|
-
- **`StampCreatedResponse`**: Returned when a new stamp is created (201 status)
|
|
238
|
-
- `commitment_receipt`: CommitmentReceipt object
|
|
239
|
-
- `file_object`: FileObject (optional)
|
|
240
|
-
|
|
241
|
-
- **`IdempotentStampResponse`**: Returned when stamp already exists (200 status)
|
|
242
|
-
- `commitment_receipt`: CommitmentReceipt object
|
|
243
|
-
|
|
244
|
-
- **`CommitmentReceipt`**: Blockchain stamp details
|
|
245
|
-
- `transaction_hash`: Blockchain transaction hash
|
|
246
|
-
- `user_address`: User's blockchain address
|
|
247
|
-
- `set_cid`: Set CID (collection)
|
|
248
|
-
- `object_cid`: Object CID (stamped data)
|
|
249
|
-
- `timestamp`: ISO format timestamp
|
|
250
|
-
- `chain_id`: Blockchain chain ID
|
|
251
|
-
|
|
252
|
-
- **`Collection`**: Collection information
|
|
253
|
-
- `id`, `name`, `cid`, `description`
|
|
254
|
-
- `is_pinned`, `is_public`
|
|
255
|
-
- `created_at`
|
|
256
|
-
|
|
257
|
-
- **`AccountSettings`**: User account details
|
|
258
|
-
- `name`, `email`, `persistent_id`
|
|
259
|
-
- `display_timezone`, `date_joined`
|
|
260
|
-
- `last_address`, `last_is_verified`
|
|
261
|
-
|
|
262
|
-
## Complete Example
|
|
263
|
-
|
|
264
|
-
```python
|
|
265
|
-
from vbase_api import VBaseAPIClient, VBaseAPIError
|
|
266
|
-
|
|
267
|
-
def main():
|
|
268
|
-
# Initialize client
|
|
269
|
-
with VBaseAPIClient(api_key="your-bearer-token") as client:
|
|
270
|
-
try:
|
|
271
|
-
# Get user info
|
|
272
|
-
user = client.get_current_user()
|
|
273
|
-
print(f"Authenticated as: {user.email}")
|
|
274
|
-
|
|
275
|
-
# Create a collection
|
|
276
|
-
collection = client.create_collection(
|
|
277
|
-
name="Trading Records",
|
|
278
|
-
cid=None,
|
|
279
|
-
description="Timestamped trading data",
|
|
280
|
-
is_pinned=True
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
# Stamp trading data
|
|
284
|
-
trade_data = {
|
|
285
|
-
"symbol": "AAPL",
|
|
286
|
-
"shares": 100,
|
|
287
|
-
"price": 150.25,
|
|
288
|
-
"timestamp": "2025-11-24T10:30:00Z"
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
stamp = client.create_stamp(
|
|
292
|
-
data=trade_data,
|
|
293
|
-
collection_name="Trading Records"
|
|
294
|
-
)
|
|
295
|
-
|
|
296
|
-
print(f"Trade stamped!")
|
|
297
|
-
print(f" CID: {stamp.commitment_receipt.object_cid}")
|
|
298
|
-
print(f" Transaction: {stamp.commitment_receipt.transaction_hash}")
|
|
299
|
-
print(f" Blockchain timestamp: {stamp.commitment_receipt.timestamp}")
|
|
300
|
-
|
|
301
|
-
# Verify the stamp
|
|
302
|
-
verification = client.verify_stamps(
|
|
303
|
-
cids=[stamp.commitment_receipt.object_cid]
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
if verification.stamp_list:
|
|
307
|
-
print("Stamp verified on blockchain!")
|
|
308
|
-
|
|
309
|
-
except VBaseAPIError as e:
|
|
310
|
-
print(f"API Error: {e}")
|
|
311
|
-
|
|
312
|
-
if __name__ == "__main__":
|
|
313
|
-
main()
|
|
314
|
-
```
|
|
315
|
-
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: vbase-api
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: vBase REST API Python Client
|
|
5
|
-
Author-email: vBase <tech@vbase.com>
|
|
6
|
-
License-Expression: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/validityBase/vbase-api-py
|
|
8
|
-
Project-URL: Documentation, https://docs.vbase.com/
|
|
9
|
-
Keywords: vbase,stamping,web3,blockchain,validation
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.8
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE.txt
|
|
15
|
-
License-File: NOTICE.txt
|
|
16
|
-
Requires-Dist: requests>=2.7.0
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# vbase-py
|
|
20
|
-
|
|
21
|
-
vBase REST API Python Client
|
|
22
|
-
|
|
23
|
-
See [documentation](https://docs.vbase.com/) and the [Swagger UI](https://app.vbase.com/swagger/) for more details.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## License
|
|
28
|
-
|
|
29
|
-
This project is licensed under the Apache 2.0 License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
|
30
|
-
|
|
31
|
-
## Introduction
|
|
32
|
-
|
|
33
|
-
vBase creates a global auditable record of when data was created, by whom, and how it has changed (collectively, “data provenance”). Data producers can prove the provenance of their data to any external party, increasing its value and marketability. Data consumers can ensure the integrity of historical data and any derivative calculations. The result is trustworthy information that can be put into production quickly without expensive and time-consuming trials.
|
|
34
|
-
|
|
35
|
-
Verifiable provenance establishes the credibility of data and calculations. For example, if you wish to prove investment skill, the recipient must be sure they are receiving a complete and accurate record of your timestamped trades or portfolios.
|
|
36
|
-
|
|
37
|
-
vBase resolves several expensive market failures common to financial data. Some of the areas that benefit include:
|
|
38
|
-
- Provably point-in-time datasets
|
|
39
|
-
- Auditable investing track records
|
|
40
|
-
- Sound backtests, historical simulations, and time-series modeling
|
|
41
|
-
|
|
42
|
-
vBase services do not require access to the data itself, assuring privacy. They also do not rely on centralized intermediaries, eliminating the technical, operating, and business risks of a trusted party controlling your data and its validation. vBase ensures data security and interoperability that is unattainable with legacy centralized systems. It does so by storing digital fingerprints of data, metadata, and revisions on secure public blockchains.
|
|
43
|
-
|
|
44
|
-
With vBase, creating and consuming provably correct data is as easy as pressing a button.
|
|
45
|
-
|
|
46
|
-
## Installation
|
|
47
|
-
|
|
48
|
-
Install the package using pip:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
pip install vbase-api
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Quick Start
|
|
55
|
-
|
|
56
|
-
### Getting Your API Key
|
|
57
|
-
|
|
58
|
-
To use the vBase API, you'll need an API key (Bearer token). You can obtain this from your [vBase account settings](https://app.vbase.com/profile#account_settings).
|
|
59
|
-
|
|
60
|
-
### Basic Usage
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
from vbase_api import VBaseAPIClient
|
|
64
|
-
|
|
65
|
-
# Initialize the client
|
|
66
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
67
|
-
|
|
68
|
-
# Stamp some data
|
|
69
|
-
stamp = client.create_stamp(data="Important data to be stamped")
|
|
70
|
-
print(f"Stamped with CID: {stamp.commitment_receipt.object_cid}")
|
|
71
|
-
|
|
72
|
-
# List your collections
|
|
73
|
-
collections = client.get_collections()
|
|
74
|
-
for collection in collections:
|
|
75
|
-
print(f"{collection.name}: {collection.cid}")
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Usage Guide
|
|
79
|
-
|
|
80
|
-
### Creating a Client
|
|
81
|
-
|
|
82
|
-
The `VBaseAPIClient` can be initialized with your API key:
|
|
83
|
-
|
|
84
|
-
```python
|
|
85
|
-
from vbase_api import VBaseAPIClient
|
|
86
|
-
|
|
87
|
-
# Basic initialization
|
|
88
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
89
|
-
|
|
90
|
-
# With custom base URL and timeout
|
|
91
|
-
client = VBaseAPIClient(
|
|
92
|
-
api_key="your-bearer-token",
|
|
93
|
-
base_url="https://app.vbase.com",
|
|
94
|
-
timeout=60
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
# Using context manager (recommended)
|
|
98
|
-
with VBaseAPIClient(api_key="your-bearer-token") as client:
|
|
99
|
-
collections = client.get_collections()
|
|
100
|
-
# Client resources are automatically cleaned up
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Stamping Data
|
|
104
|
-
|
|
105
|
-
The `create_stamp()` method is the core functionality of vBase. It allows you to create a blockchain-verified timestamp of your data.
|
|
106
|
-
|
|
107
|
-
#### Stamp Inline Data
|
|
108
|
-
|
|
109
|
-
```python
|
|
110
|
-
# Stamp text data
|
|
111
|
-
stamp = client.create_stamp(
|
|
112
|
-
data="Important document content"
|
|
113
|
-
)
|
|
114
|
-
print(f"Object CID: {stamp.commitment_receipt.object_cid}")
|
|
115
|
-
print(f"Transaction: {stamp.commitment_receipt.transaction_hash}")
|
|
116
|
-
print(f"Timestamp: {stamp.commitment_receipt.timestamp}")
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### Stamp a File
|
|
121
|
-
|
|
122
|
-
```python
|
|
123
|
-
# Stamp a file from disk
|
|
124
|
-
stamp = client.create_stamp(file="report.pdf")
|
|
125
|
-
|
|
126
|
-
# Stamp a file and add to a collection
|
|
127
|
-
stamp = client.create_stamp(
|
|
128
|
-
file="portfolio.csv",
|
|
129
|
-
collection_name="Investment Records",
|
|
130
|
-
idempotent=False
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
# Access file information
|
|
134
|
-
if stamp.file_object:
|
|
135
|
-
print(f"File: {stamp.file_object.file_name}")
|
|
136
|
-
print(f"Path: {stamp.file_object.file_path}")
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
#### Stamp precalculated CID, without uploading actual data
|
|
140
|
-
|
|
141
|
-
```python
|
|
142
|
-
# Stamp a CID that already exists
|
|
143
|
-
stamp = client.create_stamp(
|
|
144
|
-
data_cid="0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201",
|
|
145
|
-
collection_name="My Collection"
|
|
146
|
-
)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Working with Collections
|
|
150
|
-
|
|
151
|
-
Collections help organize your stamped data into logical groups.
|
|
152
|
-
|
|
153
|
-
#### List Collections
|
|
154
|
-
|
|
155
|
-
```python
|
|
156
|
-
# Get all collections
|
|
157
|
-
collections = client.get_collections()
|
|
158
|
-
for collection in collections:
|
|
159
|
-
print(f"{collection.name} - {collection.description}")
|
|
160
|
-
|
|
161
|
-
# Filter by pinned status
|
|
162
|
-
pinned_collections = client.get_collections(is_pinned=True)
|
|
163
|
-
|
|
164
|
-
# Filter by user address
|
|
165
|
-
user_collections = client.get_collections(user_address="0x...")
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
#### Create a Collection
|
|
169
|
-
|
|
170
|
-
```python
|
|
171
|
-
collection = client.create_collection(
|
|
172
|
-
name="Investment Track Records",
|
|
173
|
-
description="Auditable portfolio holdings and trades"
|
|
174
|
-
)
|
|
175
|
-
print(f"Created collection: {collection.name}")
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Verifying Stamps
|
|
179
|
-
|
|
180
|
-
Verify that specific CIDs have been stamped on the blockchain.
|
|
181
|
-
|
|
182
|
-
```python
|
|
183
|
-
# Verify one or more CIDs
|
|
184
|
-
result = client.verify_stamps(
|
|
185
|
-
cids=[
|
|
186
|
-
"0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201",
|
|
187
|
-
"0xcd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893202"
|
|
188
|
-
]
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
# Check results
|
|
192
|
-
print(f"Timezone: {result.display_timezone}")
|
|
193
|
-
for stamp in result.stamp_list:
|
|
194
|
-
print(f"Found stamp:")
|
|
195
|
-
print(f" CID: {stamp.object_cid}")
|
|
196
|
-
print(f" Timestamp: {stamp.timestamp}")
|
|
197
|
-
print(f" Transaction: {stamp.transaction_hash}")
|
|
198
|
-
print(f" User: {stamp.user_address}")
|
|
199
|
-
|
|
200
|
-
# Verify CIDs for current user only
|
|
201
|
-
result = client.verify_stamps(
|
|
202
|
-
cids=["0xbd9c71f7277c841210dd60b84be775e0a48cd6643c5e28eebf8f11b95b893201"],
|
|
203
|
-
filter_by_user=True
|
|
204
|
-
)
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Upload Previously Stamped Files
|
|
208
|
-
|
|
209
|
-
Upload a file that has already been stamped to vBase storage.
|
|
210
|
-
|
|
211
|
-
```python
|
|
212
|
-
result = client.upload_stamped_file(
|
|
213
|
-
collection_name="Investment Records",
|
|
214
|
-
file="previously_stamped.pdf"
|
|
215
|
-
)
|
|
216
|
-
print(f"Uploaded: {result.file_object.file_name}")
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### User Account Information
|
|
220
|
-
|
|
221
|
-
```python
|
|
222
|
-
# Get current user information
|
|
223
|
-
user = client.get_current_user()
|
|
224
|
-
print(f"Email: {user.email}")
|
|
225
|
-
print(f"Name: {user.name}")
|
|
226
|
-
print(f"Timezone: {user.display_timezone}")
|
|
227
|
-
print(f"Address: {user.last_address}")
|
|
228
|
-
|
|
229
|
-
# Get another user's information by address
|
|
230
|
-
other_user = client.get_user("0x1234123412341234123412341234123412341234")
|
|
231
|
-
print(f"User name: {other_user.name}")
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## Error Handling
|
|
235
|
-
|
|
236
|
-
The client raises `VBaseAPIError` for API-related errors:
|
|
237
|
-
|
|
238
|
-
```python
|
|
239
|
-
from vbase_api_py import VBaseAPIClient, VBaseAPIError
|
|
240
|
-
|
|
241
|
-
client = VBaseAPIClient(api_key="your-bearer-token")
|
|
242
|
-
|
|
243
|
-
try:
|
|
244
|
-
stamp = client.create_stamp(data={"test": "data"})
|
|
245
|
-
except VBaseAPIError as e:
|
|
246
|
-
print(f"Error: {e.message}")
|
|
247
|
-
if e.status_code:
|
|
248
|
-
print(f"Status code: {e.status_code}")
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## Response Objects
|
|
252
|
-
|
|
253
|
-
The client returns typed response objects for easy data access:
|
|
254
|
-
|
|
255
|
-
- **`StampCreatedResponse`**: Returned when a new stamp is created (201 status)
|
|
256
|
-
- `commitment_receipt`: CommitmentReceipt object
|
|
257
|
-
- `file_object`: FileObject (optional)
|
|
258
|
-
|
|
259
|
-
- **`IdempotentStampResponse`**: Returned when stamp already exists (200 status)
|
|
260
|
-
- `commitment_receipt`: CommitmentReceipt object
|
|
261
|
-
|
|
262
|
-
- **`CommitmentReceipt`**: Blockchain stamp details
|
|
263
|
-
- `transaction_hash`: Blockchain transaction hash
|
|
264
|
-
- `user_address`: User's blockchain address
|
|
265
|
-
- `set_cid`: Set CID (collection)
|
|
266
|
-
- `object_cid`: Object CID (stamped data)
|
|
267
|
-
- `timestamp`: ISO format timestamp
|
|
268
|
-
- `chain_id`: Blockchain chain ID
|
|
269
|
-
|
|
270
|
-
- **`Collection`**: Collection information
|
|
271
|
-
- `id`, `name`, `cid`, `description`
|
|
272
|
-
- `is_pinned`, `is_public`
|
|
273
|
-
- `created_at`
|
|
274
|
-
|
|
275
|
-
- **`AccountSettings`**: User account details
|
|
276
|
-
- `name`, `email`, `persistent_id`
|
|
277
|
-
- `display_timezone`, `date_joined`
|
|
278
|
-
- `last_address`, `last_is_verified`
|
|
279
|
-
|
|
280
|
-
## Complete Example
|
|
281
|
-
|
|
282
|
-
```python
|
|
283
|
-
from vbase_api import VBaseAPIClient, VBaseAPIError
|
|
284
|
-
|
|
285
|
-
def main():
|
|
286
|
-
# Initialize client
|
|
287
|
-
with VBaseAPIClient(api_key="your-bearer-token") as client:
|
|
288
|
-
try:
|
|
289
|
-
# Get user info
|
|
290
|
-
user = client.get_current_user()
|
|
291
|
-
print(f"Authenticated as: {user.email}")
|
|
292
|
-
|
|
293
|
-
# Create a collection
|
|
294
|
-
collection = client.create_collection(
|
|
295
|
-
name="Trading Records",
|
|
296
|
-
cid=None,
|
|
297
|
-
description="Timestamped trading data",
|
|
298
|
-
is_pinned=True
|
|
299
|
-
)
|
|
300
|
-
|
|
301
|
-
# Stamp trading data
|
|
302
|
-
trade_data = {
|
|
303
|
-
"symbol": "AAPL",
|
|
304
|
-
"shares": 100,
|
|
305
|
-
"price": 150.25,
|
|
306
|
-
"timestamp": "2025-11-24T10:30:00Z"
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
stamp = client.create_stamp(
|
|
310
|
-
data=trade_data,
|
|
311
|
-
collection_name="Trading Records"
|
|
312
|
-
)
|
|
313
|
-
|
|
314
|
-
print(f"Trade stamped!")
|
|
315
|
-
print(f" CID: {stamp.commitment_receipt.object_cid}")
|
|
316
|
-
print(f" Transaction: {stamp.commitment_receipt.transaction_hash}")
|
|
317
|
-
print(f" Blockchain timestamp: {stamp.commitment_receipt.timestamp}")
|
|
318
|
-
|
|
319
|
-
# Verify the stamp
|
|
320
|
-
verification = client.verify_stamps(
|
|
321
|
-
cids=[stamp.commitment_receipt.object_cid]
|
|
322
|
-
)
|
|
323
|
-
|
|
324
|
-
if verification.stamp_list:
|
|
325
|
-
print("Stamp verified on blockchain!")
|
|
326
|
-
|
|
327
|
-
except VBaseAPIError as e:
|
|
328
|
-
print(f"API Error: {e}")
|
|
329
|
-
|
|
330
|
-
if __name__ == "__main__":
|
|
331
|
-
main()
|
|
332
|
-
```
|
|
333
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|