{"id":25949767,"url":"https://github.com/nextu1337/go-nanoproto","last_synced_at":"2025-03-04T12:29:04.713Z","repository":{"id":280199388,"uuid":"941268481","full_name":"nextu1337/go-nanoproto","owner":"nextu1337","description":"nanoproto: A Golang library for saving and reading protocol buffers (and other byte data) on the NANO ($XNO) cryptocurrency network. Designed for decentralized applications leveraging NANO's feeless and fast transactions.","archived":false,"fork":false,"pushed_at":"2025-03-01T22:28:54.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T23:23:12.429Z","etag":null,"topics":["go","golang","nanocurrency","protobuf"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nextu1337.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":"2025-03-01T22:07:47.000Z","updated_at":"2025-03-01T22:37:36.000Z","dependencies_parsed_at":"2025-03-01T23:34:06.444Z","dependency_job_id":null,"html_url":"https://github.com/nextu1337/go-nanoproto","commit_stats":null,"previous_names":["nextu1337/go-nanoproto"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextu1337%2Fgo-nanoproto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextu1337%2Fgo-nanoproto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextu1337%2Fgo-nanoproto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextu1337%2Fgo-nanoproto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextu1337","download_url":"https://codeload.github.com/nextu1337/go-nanoproto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241847340,"owners_count":20030235,"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":["go","golang","nanocurrency","protobuf"],"created_at":"2025-03-04T12:29:04.116Z","updated_at":"2025-03-04T12:29:04.685Z","avatar_url":"https://github.com/nextu1337.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nanoproto\n\n**nanoproto** is a Golang library designed to save and read protocol buffers (and other byte data) on the NANO ($XNO) cryptocurrency network. It leverages NANO's feeless and fast transactions to enable decentralized data storage and retrieval.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/nextu1337/go-nanoproto.svg)](https://pkg.go.dev/github.com/nextu1337/go-nanoproto)\n\n## Features\n- Save and retrieve byte data (including protocol buffers) on the NANO network.\n- Simple integration with NANO RPC nodes.\n- Supports encoding and decoding of protocol buffers for structured data storage.\n\n## How it works\n**nanoproto** uses the NANO network's representative system to store and retrieve data. The library creates a new block for each data entry (~1 entry per 32 bytes of data), with the data stored in the block's `representative` field.\n\n### How does this project differ from other NANO data storage projects?\nWhile there aren't many projects that focus on storing data on the NANO network (for obvious reasons), **nanoproto** aims to provide the simplest and most storage efficient way to store and retrieve data on the NANO network. It uses protocol buffers to encode and decode data, allowing for structured data storage and retrieval and representative changes instead of small NANO amounts being sent from address to address (which is less efficient and takes more storage + computing power).\n\n## Installation\n\nTo use **nanoproto**, ensure you have Go installed, then run:\n\n```bash\ngo get github.com/nextu1337/go-nanoproto\n```\n\n## Usage\n\nBelow is an example of how to use **nanoproto** with **go-raw-protobuf** to store and retrieve data on the NANO network:\n\n```go\npackage main\n\nimport (\n\t\"encoding/hex\"\n\t\"fmt\"\n\n\t\"github.com/nextu1337/go-nanoproto\"\n\tprotobuf \"github.com/nextu1337/go-raw-protobuf\"\n)\n\nfunc main() {\n\t// Initialize the RPC client\n\trpc := nanoproto.NewRPC(\"https://rainstorm.city/api\")\n\taddress := \"nano_3amxrw4dbmjizkuuqo44pt1rbq49o5rsibhc9tjb6mxcxyr13yc5cir3wxc4\"\n\tprivateKey := \"AAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\"\n\n\t// Create a new NanoDataStorage instance\n\tstorage := nanoproto.NanoDataStorage{rpc, \u0026address, \u0026privateKey}\n\n\t// Define the storage address\n\tstorageAddress := \"nano_1zaxxczbjn1o5imqrxek8m7b1ji1zactwy5yit19xqni68i6beo9a5a1an6x\"\n\n\t// Retrieve data from the NANO network\n\tfmt.Println(\"Getting storage\")\n\tdata, err := storage.GetData(\u0026storageAddress)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Decode and print the retrieved data\n\tfor _, chunk := range data {\n\t\tdecoded := protobuf.DecodeProto(chunk)\n\t\tfmt.Println(\"--------------------\")\n\t\tfmt.Println(hex.EncodeToString(chunk))\n\t\tfmt.Println(\"Decoded data\", protobuf.ProtoPartsToArray(decoded.Parts))\n\t\tif len(decoded.LeftOver) \u003e 0 {\n\t\t\tfmt.Println(\"LeftOver bytes\", decoded.LeftOver)\n\t\t}\n\t}\n\n\t// Encode and store new data on the NANO network\n    fmt.Println(\"--------------------\")\n\tfmt.Println(\"Setting storage\")\n\n\tvar buf []interface{} = []interface{}{1, 2, 3, \"This works!\"}\n\n    // Encode the data as protobuf\n\tbytes := protobuf.EncodeProto(protobuf.ArrayToProtoParts(buf))\n    \n\tfmt.Println(hex.EncodeToString(bytes))\n\n\tstorage.PutData(bytes)\n}\n```\n\n## Documentation\n\n### `NewRPC(url string) *RPC`\nInitializes a new RPC client with the specified NANO node URL.\n\n### `NanoDataStorage`\nA struct that holds the RPC client, address, and private key for interacting with the NANO network.\n\n#### Methods:\n- `GetData(reps *string) ([][]byte, error)`: Retrieves data from the specified NANO address.\n- `PutData(data []byte) error`: Stores the provided byte data on the NANO network.\n\n## Contributing\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n---\n\n**Disclaimer**: This library is experimental and should be used with caution. Ensure you understand the risks of storing data on the NANO network before using it in production.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextu1337%2Fgo-nanoproto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextu1337%2Fgo-nanoproto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextu1337%2Fgo-nanoproto/lists"}