{"id":13514318,"url":"https://github.com/orbs-network/orbs-contract-sdk","last_synced_at":"2025-06-23T08:34:00.558Z","repository":{"id":57494646,"uuid":"148645675","full_name":"orbs-network/orbs-contract-sdk","owner":"orbs-network","description":"SDK for developers of smart contracts running on Orbs","archived":false,"fork":false,"pushed_at":"2023-10-17T13:39:55.000Z","size":388,"stargazers_count":17,"open_issues_count":29,"forks_count":9,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-01T17:37:31.154Z","etag":null,"topics":["golang","sdk","smart-contract"],"latest_commit_sha":null,"homepage":"https://orbs.gitbook.io","language":"Go","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/orbs-network.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-13T13:56:52.000Z","updated_at":"2024-09-14T10:29:27.000Z","dependencies_parsed_at":"2024-06-18T20:09:09.060Z","dependency_job_id":"566860cb-679f-4e11-9754-ea5b7adeabdf","html_url":"https://github.com/orbs-network/orbs-contract-sdk","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-contract-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-contract-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-contract-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbs-network%2Forbs-contract-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orbs-network","download_url":"https://codeload.github.com/orbs-network/orbs-contract-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225850245,"owners_count":17534067,"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":["golang","sdk","smart-contract"],"created_at":"2024-08-01T05:00:52.708Z","updated_at":"2024-11-22T06:09:04.028Z","avatar_url":"https://github.com/orbs-network.png","language":"Go","funding_links":[],"categories":["Go","Libraries \u0026 SDK"],"sub_categories":[],"readme":"# Orbs Smart Contract SDK\n\n[![CircleCI](https://circleci.com/gh/orbs-network/orbs-contract-sdk/tree/master.svg?style=svg)](https://circleci.com/gh/orbs-network/orbs-contract-sdk/tree/master)\n\nThe Orbs smart contract SDK is a framework for building decentralized applications over the Orbs blockchain. These applications are made of smart contracts written in the [Go](https://en.wikipedia.org/wiki/Go_(programming_language)) programming language.\n\n\u003e Note: While the Orbs smart contract SDK is stable, it is still under active development; there may be breaking changes.\n\nSupport for additional programming languages like JavaScript is under way, [contact us](FeatureRequest@orbs.com) for more information.\n\n\u0026nbsp;\n\n## Table of contents\n\n* [Detailed documentation](https://orbs.gitbook.io)\n* [Quick start](#quick-start)\n* [Deploying your first contract](#deploying-your-first-contract)\n* [Next steps](#next-steps)\n\n\u0026nbsp;\n\n## Quick start\n\n### Prerequisites (Mac)\n\n* Make sure [brew](https://brew.sh/) is available on your machine.\n\n* Make sure [Go language](https://golang.org/doc/install) 1.10+ is installed on your machine.\n   \n    \u003e Verify the installation by running in terminal `go version`\n\n* To test contracts locally, make sure [Docker](https://docs.docker.com/docker-for-mac/install/) is installed on your machine.\n\n### Installation \n\n1. Download the Orbs smart contract SDK by running in terminal:\n\n    ```\n    go get -u github.com/orbs-network/orbs-contract-sdk/...\n    ```\n\n   \u003e It will be downloaded to your Go workspace, typically `~/go/src/github.com/orbs-network/orbs-contract-sdk`\u003cbr\u003e[Example contracts](https://github.com/orbs-network/orbs-contract-sdk/tree/master/go/examples) will be at `~/go/src/github.com/orbs-network/orbs-contract-sdk/go/examples`\n\n2. Install [Gamma](https://github.com/orbs-network/gamma-cli), a personal Orbs blockchain running locally, by running in terminal:\n\n    ```\n    brew install orbs-network/devtools/gamma-cli\n    ```\n    \n    \u003e To verify the installation, run in terminal `gamma-cli version`\n\n\u0026nbsp;\n\n## Deploying your first contract\n\n### 1. Write a simple contract\n\nLet's write a simple example that implements a counter. This will be our code [`counter.go`](https://github.com/orbs-network/orbs-contract-sdk/blob/master/go/examples/counter/counter.go)\n\n```go\npackage main\n\nimport (\n    \"github.com/orbs-network/orbs-contract-sdk/go/sdk/v1\"\n    \"github.com/orbs-network/orbs-contract-sdk/go/sdk/v1/state\"\n)\n\nvar PUBLIC = sdk.Export(add, get)\nvar SYSTEM = sdk.Export(_init)\n\nvar COUNTER_KEY = []byte(\"count\")\n\nfunc _init() {\n    state.WriteUint64(COUNTER_KEY, 0)\n}\n\nfunc add(amount uint64) {\n    count := state.ReadUint64(COUNTER_KEY)\n    count += amount\n    state.WriteUint64(COUNTER_KEY, count)\n}\n\nfunc get() uint64 {\n    return state.ReadUint64(COUNTER_KEY)\n}\n```\n\n### 2. Start Gamma server\n\nWe'll test our contract on Gamma server - a locally running blockchain. Start it from terminal:\n\n```\ngamma-cli start-local\n```\n\n### 3. Deploy the contract\n\nTo deploy the counter contract, run in terminal:\n\n```\ngamma-cli deploy counter.go -name MyCounter\n```\n\n\u003e If the deploy is successful, you'll see a response similar to this:\n\n```json\n{\n  \"RequestStatus\": \"COMPLETED\",\n  \"TxId\": \"7Y4urVmKvunYsxh7kKhUoQ72XjSJcdkBxxzBcauC9icC9gzMy8mPDcg\",\n  \"ExecutionResult\": \"SUCCESS\",\n  \"OutputArguments\": [],\n  \"TransactionStatus\": \"COMMITTED\",\n  \"BlockHeight\": \"1869\",\n  \"BlockTimestamp\": \"2018-12-05T13:05:51.347Z\"\n}\n```\n\n### 4. Send a transaction to increment the counter\n\nWrite the transaction details in a JSON file named [`add-25.json`](https://github.com/orbs-network/orbs-contract-sdk/blob/master/go/examples/counter/test/add-25.json)\n\n```json\n{\n  \"ContractName\": \"MyCounter\",\n  \"MethodName\": \"add\", \n  \"Arguments\": [\n    {\n      \"Type\": \"uint64\",\n      \"Value\": \"25\"\n    }\n  ]\n}\n```\n\nTo increment the counter by 75, let's send this transaction 3 times from terminal:\n\n```\ngamma-cli send-tx add-25.json -signer user1\ngamma-cli send-tx add-25.json -signer user1\ngamma-cli send-tx add-25.json -signer user1\n```\n\n\u003e Note: The transaction will be signed by `user1`, an example account found in `orbs-test-keys.json`\n\n### 5. Read the counter value\n\nWrite the query details in a JSON file named [`get.json`](https://github.com/orbs-network/orbs-contract-sdk/blob/master/go/examples/counter/test/get.json)\n\n```json\n{\n  \"ContractName\": \"MyCounter\",\n  \"MethodName\": \"get\",\n  \"Arguments\": []\n}\n```\n\nThis query will read the counter value from the contract's state. Send it from terminal:\n\n```\ngamma-cli run-query get.json\n```\n\n\u003e Note: Transactions that change state require consensus by several nodes. Reading state with queries is a simpler action that doesn't require consensus.\n\n### 6. Stop Gamma server\n\nSince we're done testing, the server is no longer needed. Let's stop it from terminal:\n\n```\ngamma-cli stop-local\n```\n\n\u0026nbsp;\n\n## Next steps\n\n* Explore more examples of contracts [here](https://github.com/orbs-network/orbs-contract-sdk/tree/master/go/examples).\n\n* Read more about Gamma, the local Orbs blockchain, [here](https://github.com/orbs-network/gamma-cli).\n\n    \u003e You can also run in terminal `gamma-cli help`\n    \n* Explore the API of the SDK [here](https://github.com/orbs-network/orbs-contract-sdk/tree/master/go/sdk).\n\n* After your contracts are deployed to test net or main net, build clients that access them using the [Orbs Client SDK](https://github.com/orbs-network/orbs-client-sdk-go).\n\n\u0026nbsp;\n\n## Detailed documentation\n\nThe detailed documentation website for Orbs Contract SDK is available here:\n\nhttps://orbs.gitbook.io\n\n\u0026nbsp;\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbs-network%2Forbs-contract-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forbs-network%2Forbs-contract-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbs-network%2Forbs-contract-sdk/lists"}