{"id":27884551,"url":"https://github.com/oasisprotocol/demo-starter-py","last_synced_at":"2025-11-09T09:04:12.329Z","repository":{"id":270517687,"uuid":"836813954","full_name":"oasisprotocol/demo-starter-py","owner":"oasisprotocol","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-17T11:29:25.000Z","size":54,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-18T01:52:56.101Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oasisprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-01T16:00:28.000Z","updated_at":"2025-04-11T10:56:17.000Z","dependencies_parsed_at":"2024-12-31T21:33:49.632Z","dependency_job_id":"e86a1f6c-9846-4b70-a90e-473c6f1e3762","html_url":"https://github.com/oasisprotocol/demo-starter-py","commit_stats":null,"previous_names":["oasisprotocol/demo-starter-py"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fdemo-starter-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fdemo-starter-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fdemo-starter-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fdemo-starter-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oasisprotocol","download_url":"https://codeload.github.com/oasisprotocol/demo-starter-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252454919,"owners_count":21750507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-05T06:37:53.880Z","updated_at":"2025-10-03T22:44:24.342Z","avatar_url":"https://github.com/oasisprotocol.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oasis Starter dApp in Python\n\nThis is a skeleton for confidential Oasis dApps in Python.\n\n## Prerequisites\n\nThis project was tested on python 3.12, but should work with most\npython3 versions. \nUse pyenv to handle multiple python installations.\n\n## Installation\n\n1. Initialize an environment using preferred environment manager \n   (venv, pipx...) ```python3 -m venv my_env```.\n2. Install the [`oasis-sapphire-py`](https://pypi.org/project/oasis-sapphire-py/) client library and\n   other dependencies from requirements.txt ```pip install -r requirements.txt```.\n\n## Setup\n\n1. If running sapphire-localnet make sure to launch the \n[local node](https://github.com/oasisprotocol/oasis-web3-gateway/tree/main/docker).\n\n2. Add your deployer private key to the environment variables \n```export PRIVATE_KEY=\u003cmy_private_key\u003e```. Make sure you have \nenough funds to cover the gas fees.\n\n## Running\n\nThe **./src** folder contains the .py files which are used to compile, \ndeploy and interact with the contracts inside \n**./contracts** folder. \nIt also contains the ```main.py``` for command line development. \nAgain make sure to follow the setup \n[instructions](#Setup) before running scripts.\nOpen main.py which contains a simple starter example.\n\n### Initialization\n\nThe `ContractUtility` class is used to compile and deploy the contracts, \nbased on the network name (sapphire, sapphire-testnet, sapphire-localnet).\nThe private key used to deploy the contract is fetched from the PRIVATE_KEY \nenvironment variable.\n\n```python\ncontract_utility = ContractUtility(\"sapphire-localnet\")\n```\n\n### Compiling the contract\n\nAfter saving the .sol contract in **./contracts** folder, \nwe can continue with compilation step.\n\nTo compile use class method ```setup_and_compile_contract()``` \nfrom **ContractUtility.py**.\n\n```python\nfrom src.ContractUtility import ContractUtility\n\nContractUtility.setup_and_compile_contract(\"MessageBox\")\n```\n\n### Deploying the contract\n\n```python\nawait contract_utility.deploy_contract(\"MessageBox)\n```\nProvide the contract name, in the starter example case \nwe use the provided **MessageBox** without the .sol extension.\n\n### Interacting with the contract\n\nTo help you get started with development,  ```main.py``` \ncontains some functionality that showcases web3.py \ncontract abstraction interaction.\nIt contains ```set_message()``` and ```get_message()``` \nfunctions that set message and query the contract view function \n```message()``` respectively. Message is fetched using the [EIP-712 signed queries](https://docs.oasis.io/build/sapphire/develop/authentication/) which allows for \nprivate data retrieval (msg.sender == author access control).\n\n### Run example\n\nTo run: ```python3 main.py```\n\n### CLI development\n\nTo compile, deploy and call the interact_with_contract() \nfunction from the terminal:\n```shell\npython3 main.py compile\npython3 main.py deploy --network sapphire-localnet\npython3 main.py setMessage --address \u003ccontract_address\u003e --message \"Hello world\" --network sapphire-localnet\npython3 main.py message --address \u003ccontract_address\u003e --network  sapphire-localnet\n```\n\n## Testing\n\nSome inital unit tests are located in **./tests** folder. \nRun ```pytest``` in the terminal. \nEnd-to-end tests are set to ```sapphire-localnet```, \ncheck ```tests/test_ContractUtility.py``` if you want to change the network.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foasisprotocol%2Fdemo-starter-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foasisprotocol%2Fdemo-starter-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foasisprotocol%2Fdemo-starter-py/lists"}