{"id":25100540,"url":"https://github.com/anataliocs/happy-points-system","last_synced_at":"2026-02-17T03:05:37.482Z","repository":{"id":274030683,"uuid":"921499015","full_name":"anataliocs/happy-points-system","owner":"anataliocs","description":"Low-level approach to examine some of the fundamental concepts of Stellar Smart Contract Storage.","archived":false,"fork":false,"pushed_at":"2025-02-04T11:50:22.000Z","size":483,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T05:46:45.317Z","etag":null,"topics":["rust","smart-contracts","stellar-network","stellar-sdk","typescript"],"latest_commit_sha":null,"homepage":"https://developers.stellar.org/docs/build/smart-contracts/example-contracts/storage","language":"TypeScript","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/anataliocs.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}},"created_at":"2025-01-24T04:03:14.000Z","updated_at":"2025-02-06T14:05:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"1eadebf5-15c7-405b-b8ba-4c7449f57381","html_url":"https://github.com/anataliocs/happy-points-system","commit_stats":null,"previous_names":["anataliocs/happy-points-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anataliocs/happy-points-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Fhappy-points-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Fhappy-points-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Fhappy-points-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Fhappy-points-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anataliocs","download_url":"https://codeload.github.com/anataliocs/happy-points-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Fhappy-points-system/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261212459,"owners_count":23125581,"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":["rust","smart-contracts","stellar-network","stellar-sdk","typescript"],"created_at":"2025-02-07T20:16:29.150Z","updated_at":"2026-02-17T03:05:37.464Z","avatar_url":"https://github.com/anataliocs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demo of Stellar Smart Contract Storage\n\nStorage on Stellar smart contracts is not simple.\n\nThis developer journey will walk you through not just the intricacies of Storage but also give you some great practical\nknowledge about implementing your own point system. We will take a low-level approach to really examine some of the\nfundamental concepts of Stellar Smart Contracts.\n\nThis tutorial is specifically designed for new Stellar developers!\n\nWhile Stellar smart contract storage can seem pretty complicated at first, it offers a huge amount of opportunity for\noptimization and minimization of invocation fees for your users!  So a little bit of work up front, will go a long way\ndown the line for your contract!\n\n## Tests\n\nTests with logs enabled:\n\n```\ncargo test -- --nocapture\n```\n\n## Build and Deploy Contract with Stellar CLI\n\nRun a local stellar network, deploy contract to local, invoke `set_balance_persistent()`, encode LedgerKey as\nXDR and extend TTL of persistent storage data by key.\n\n### Run Local Stellar Network\n\nRun local Stellar network for testing\n\n```\nstellar container start local --limits testnet\n```\n\nUse local:\n\n```\nstellar network use local\n```\n\nDeploy to local standalone:\n\n```\nstellar contract deploy \\\n    --wasm target/wasm32-unknown-unknown/release/happy_points_system.wasm \\\n    --source alice \\\n    --network local\n```\n\nInvoke `set_balance_persistent()` function:\n\n```\nstellar contract invoke \\\n    --id CAWI33QKYJ2JV42O2KQG36MHBKQO4F3IKZPKT6C2HL7OI5VNAEM2SDE7 \\\n    --source alice \\\n    -- \\\n    set_balance_persistent \\\n    --amount 1000 \\\n    --addr GANUUSIQOCQOGQRV5KR7CO64SATSFLLPRRWX5XDKXYFZ7Y4XWTEALQOX\n```\n\nInvoke `get_balance_persistent()` function:\n\n```\nstellar contract invoke \\\n    --id CAWI33QKYJ2JV42O2KQG36MHBKQO4F3IKZPKT6C2HL7OI5VNAEM2SDE7 \\\n    --source alice \\\n    -- \\\n    get_balance_persistent \\\n    --addr GANUUSIQOCQOGQRV5KR7CO64SATSFLLPRRWX5XDKXYFZ7Y4XWTEALQOX\n```\n\nEncode LedgerKey JSON `ledgerkey.json` as XDR:\n\n```\nstellar xdr encode --type LedgerKey --input json --output single-base64 ledgerkey.json\n```\n\nExtend TTL of persistent storage by 10,000 ledgers:\n\n```\nstellar contract extend \\\n    --source alice \\\n    --id CABOIXXESAYVMNXP4HBU44DUTWFZAQAZJK5A44UFOR2KSGDHD5KUCQAJ \\\n    --key-xdr AAAABgAAAAGwZ1dyW0P7qAx913CFhpYGupGYPd3Fd1H8ujJu+y4QygAAABAAAAABAAAAAgAAAA8AAAAHQmFsYW5jZQAAAAASAAAAAAAAAAAbSkkQcKDjQjXqo/E73JAnIq1vjG1+3Gq+C5/jl7TIBQAAAAE= \\\n    --ledgers-to-extend 10000 \\\n    --durability persistent\n```\n\nCheck TTL\n\n```\nstellar contract read \\\n    --output xdr \\\n    --id CABOIXXESAYVMNXP4HBU44DUTWFZAQAZJK5A44UFOR2KSGDHD5KUCQAJ \\\n    --key-xdr AAAABgAAAAEC5F7kkDFWNu/hw05wdJ2LkEAZSroOcoV0dKkYZx9VQQAAABAAAAABAAAAAgAAAA8AAAAHQmFsYW5jZQAAAAASAAAAAAAAAAAbSkkQcKDjQjXqo/E73JAnIq1vjG1+3Gq+C5/jl7TIBQAAAAE= \\\n    --durability persistent \\\n    --network testnet \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanataliocs%2Fhappy-points-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanataliocs%2Fhappy-points-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanataliocs%2Fhappy-points-system/lists"}