{"id":13444341,"url":"https://github.com/OpShin/opshin-starter-kit","last_synced_at":"2025-03-20T18:32:21.772Z","repository":{"id":170393328,"uuid":"593578863","full_name":"OpShin/opshin-starter-kit","owner":"OpShin","description":"On-chain and off-chain code for a Python Smart Contract using opshin and pycardano","archived":false,"fork":false,"pushed_at":"2023-09-15T13:33:22.000Z","size":86,"stargazers_count":16,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T22:52:16.696Z","etag":null,"topics":["cardano","demeter-run","off-chain","on-chain","plutus","python","smart-contracts"],"latest_commit_sha":null,"homepage":"https://demeter.run/code?repository=https://github.com/opshin/opshin-starter-kit.git\u0026template=python\u0026source=demeter\u0026key=opshin-starter-kit","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpShin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-01-26T11:09:14.000Z","updated_at":"2024-12-20T06:02:23.000Z","dependencies_parsed_at":"2024-01-28T11:23:05.653Z","dependency_job_id":"3aaf7c94-43b7-477c-a3c4-d3cca802273a","html_url":"https://github.com/OpShin/opshin-starter-kit","commit_stats":null,"previous_names":["opshin/opshin-starter-kit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fopshin-starter-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fopshin-starter-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fopshin-starter-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fopshin-starter-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpShin","download_url":"https://codeload.github.com/OpShin/opshin-starter-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244670522,"owners_count":20491000,"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":["cardano","demeter-run","off-chain","on-chain","plutus","python","smart-contracts"],"created_at":"2024-07-31T04:00:20.326Z","updated_at":"2025-03-20T18:32:21.435Z","avatar_url":"https://github.com/OpShin.png","language":"Python","funding_links":[],"categories":["Examples"],"sub_categories":[],"readme":"# OpShin Starter-kit\n\u003ca href=\"https://github.com/OpShin/awesome-opshin\"\u003e\u003cimg src=\"https://img.shields.io/badge/awesome-opshin-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAYAAAB2+A+pAAAGQklEQVRIx52Ve2yVdxnHP8/vPe+59U5pqdwqFxFpwbVzHesgWVwZrsJKZRMd4ObMkjkVDIst3ZSEzU0mNkv8wzGXoazFWc1YRA0MBsNuZg4lZXRgay3QcisF2lJoT8/pe97HP87pVUDPfsmb35vf7ft8n8v3kfu//HCR40TzgUvA4f1v110kPn6wJyxu2C1BWQXcCUwFXOAkcAD4RXV5oJ1PMKRy4+an3z303vPh8ADJSanRYFLKH4HdiPHm3PPVR73+7IV2MBNfahYeX3D8/RCwvro88GrCwEuWrrqjuanhcFdXBwB5+QtJTc0gEgnT030JMQa/P0gwmELOzPmkz1lEvycFJxolKzcPY9kA364uD2xLBNgAJwKBpMGhBVUl78mnQtd6u2ltbeTfLR/xceMHHG2oZ+BKK3J6D9+5W/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AoVZ5G4+ric0yhYgOJaxZSpipkOHO40uTwBrrOs6nm/R9cAWY/DH6xgExEC+XiLfaog1G8957MCIyx0P6baPFxVmoYSGgfXKGxNxtShWo0pnJBuxRulEjNUeMSNgs5OhPQJqIJUIJU49cTGZ2EfaBmOP3G+6TrVlM9Q2z4ww9lrTUARXwVVC6h/D9kYjxQtJAmFRSgeP4Lf638GVLQjrHOPDlnjcY6wniMQMEeHdEWDb6him5iqZch3jDsviaIkcjufx/tj8gKeRqXLqI4x5SKasUb1QezIg/QSSwYkA0Zi7RcAykGOcXw8Di3/lBdXd76G6GFeZYbczxcym0w2MAZZRRRjA4T49Rq77rw9BlknW6p6YLMk7fhM6P8P0TD6XnI7rxAxOZ4DFoYY3J2cU/21MHav+eR7wPmgGKD1uBrvDRVyL2kMxRgR8EmWBOc8C/Ri/9r1G1P2epK0KjXmr+7dfiJjgrrPemdN6TCo+jZAbbj2YPNhVLhO/3vvfAqJ7PwtsB4pBcbA4FZ1BjxvAQsk2XeSY83g0fBRXK8Uu33dTvb/2uwCwFMgBmnH1kKSt0lt2J9X9i4Ay0DtAJ4EK6EXQw+D+AfSvIsuVTzj+AwGKaSmc5OLIAAAAAElFTkSuQmCC\"\u003e\u003c/a\u003e\n\nThis Starter-Kit is a small tutorial of how to use the [PyCardano](https://github.com/Python-Cardano/pycardano) library \nwith [opshin](https://github.com/OpShin/opshin) for interacting with a simple vesting contract on Cardano.\n\nPyCardano is a Cardano library written in Python. It allows users to create and sign transactions without depending on third-party Cardano serialization tools, such as cardano-cli and cardano-serialization-lib, making it a lightweight library, which is simple and fast to set up in all types of environments.\n\nopshin is a Smart Contract language based on Python. It allows users to define and compile Smart Contracts directly within a python environment.\nIt also interacts seemlessly with PyCardano.\n\n## Dev Environment\n\nFor executing the scripts in this starter kit you'll need access to a running [Ogmios](https://ogmios.dev/) instance.\n\nIn case you don't want to install the required components yourself, you can use [Demeter.run](https://demeter.run) platform to create a cloud environment with access to common Cardano infrastructure. The following command will open this repo in a private, web-based VSCode IDE with access to a running Ogmios instance in the preview network.\n\n[![Code in Cardano Workspace](https://demeter.run/code/badge.svg)](https://demeter.run/code?repository=https://github.com/opshin/opshin-starter-kit.git\u0026template=python\u0026source=demeter\u0026key=opshin-starter-kit)\n\n\n## What is Included\n\nWe have included a number of python scripts for executing specific actions.\nYou can find scripts to initialize addresses and interact with the cardano-node in `scripts`.\n`src` contains two folders, `on_chain` which hosts the actual opshin contract and `off-chain` which\nhosts tooling to interact with the contract.\n\n\n## Setup\n\n\n1. Install Python 3.8, 3.9 or 3.10.\n\nOn demeter.run or Linux/Ubuntu, this version of python is usually already pre-installed. You can skip this step.\nFor other Operating Systems, you can download the installer [here](https://www.python.org/downloads/release/python-3810/).\n\n2. Ensure `python3 --version` works in your command line. Open a Terminal in the browser VSCode interface (F1 -\u003e Terminal: Create New Terminal)\nIn Windows, you can do this by copying the `python.exe` file to `python3.exe` in your `PATH` environment variable.\n\n3. Install python poetry.\n\nOn demeter.run or Linux/Ubuntu run \n```bash\ncurl -sSL https://install.python-poetry.org | python3 -\n```\nFollow the instructions diplayed to add poetry to your local shell.\n\nOtherwise, follow the official documentation [here](https://python-poetry.org/docs/#installation).\n\n\n4. Install a python virtual environment with poetry:\n```bash\n# install python dependencies\npoetry install\n# run a shell with the virtual environment activated\npoetry shell\n```\n\n5. Set up [ogmios](https://ogmios.dev/) and optionally [kupo](https://cardanosolutions.github.io/kupo/).\n\nOn demeter.run, simply add the Ogmios Extension for the Preview network\nthrough the project console website (the page that shows you demeter.run project -\u003e Connected Extensions -\u003e Browse Extensions -\u003e Cardano Ogmios)\nIf you want to add kupo, use the Kupo Extension as well.\n\nMake sure the following environment variables are set (defaults are displayed):\n\n```bash\nOGMIOS_API_HOST=localhost\nOGMIOS_API_PORT=1337\nOGMIOS_API_PROTOCOL=ws\n\nKUPO_API_HOST=None\nKUPO_API_PORT=80\nKUPO_API_PROTOCOL=http\n```\n\n## Running the scripts\n\nOnce you have entered the poetry shell, you can start interacting with the contract through the prepared scripts.\n\nFirst, we have to build the vesting contract and generate two key pairs, one for the\nowner of funds and one for the intended beneficiary.\n\n```bash\npython3 scripts/build.py\npython3 scripts/create_key_pair.py owner\npython3 scripts/create_key_pair.py beneficiary\n```\n\nMake sure that the owner is loaded up with some testnet ada before proceeding,\nby using the [testnet faucet](https://docs.cardano.org/cardano-testnet/tools/faucet).\nYou can find the address of the owner key by running this command\n\n```bash\ncat keys/owner.addr\n```\n\nAfter requesting ada for the owner, send some ada to the beneficiary. The receiver address needs a small amount of ada\nin order to provide it as collateral when unlocking the funds later.\n\n```bash\npython3 src/off_chain/distribute.py owner beneficiary \n```\n\nThen you can place a vested amount of ada at the contract.\nIf you just requested funds for the owner address, you might need to wait a few minutes or the script will display an error that funds are missing.\n\n\n```bash\npython3 src/off_chain/make_vest.py owner beneficiary \n```\n\nBy default the deadline is 0 seconds after the creation of the vesting, so you can directly proceed and unlock\nthe vested amount with the beneficiary!\n\n```bash\npython3 src/off_chain/collect_vest.py beneficiary\n```\n\nThat's it! You successfully compiled a Smart Contract on cardano and interacted with it through off-chain tooling.\nFeel free to dive into the provided scripts and start customizing them for your needs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpShin%2Fopshin-starter-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpShin%2Fopshin-starter-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpShin%2Fopshin-starter-kit/lists"}