{"id":13454224,"url":"https://github.com/go-steem/rpc","last_synced_at":"2025-03-24T05:33:18.221Z","repository":{"id":57486859,"uuid":"59690650","full_name":"go-steem/rpc","owner":"go-steem","description":"Golang RPC client library for Steem - https://steem.io","archived":false,"fork":false,"pushed_at":"2019-04-29T14:49:27.000Z","size":103,"stargazers_count":45,"open_issues_count":1,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-28T21:37:56.875Z","etag":null,"topics":["golang","steem"],"latest_commit_sha":null,"homepage":"","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/go-steem.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}},"created_at":"2016-05-25T19:12:10.000Z","updated_at":"2024-10-01T13:33:02.000Z","dependencies_parsed_at":"2022-09-01T22:51:21.937Z","dependency_job_id":null,"html_url":"https://github.com/go-steem/rpc","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-steem%2Frpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-steem%2Frpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-steem%2Frpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-steem%2Frpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-steem","download_url":"https://codeload.github.com/go-steem/rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217337,"owners_count":20579290,"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","steem"],"created_at":"2024-07-31T08:00:51.997Z","updated_at":"2025-03-24T05:33:17.945Z","avatar_url":"https://github.com/go-steem.png","language":"Go","funding_links":[],"categories":["SDKs"],"sub_categories":[],"readme":"# go-steem/rpc\n\n[![GoDoc](https://godoc.org/github.com/go-steem/rpc?status.svg)](https://godoc.org/github.com/go-steem/rpc)\n\nGolang RPC client library for [Steem](https://steem.io).\n\n## Compatibility\n\n`steemd 0.13.0`\n\n## Usage\n\n```go\nimport \"github.com/go-steem/rpc\"\n```\n\nThis package is still very much in development, so `gopkg.in` is not yet available.\n\n## Installation\n\nThis package calls [bitcoin-core/secp256k1](https://github.com/bitcoin-core/secp256k1)\nusing CGO to implement signed transactions, so you need to install `secp256k1` first.\nThen it will be possible to build `go-steem/rpc`.\n\nIn case you don't need signed transactions, i.e. you don't need to use\n`network_broadcast_api`, it is possible to build the package with `nosigning`\ntag to exclude the functionality:\n\n```bash\n$ go build -tags nosigning\n```\n\n## Example\n\nThis is just a code snippet. Please check the `examples` directory\nfor more complete and ready to use examples.\n\n```go\n// Instantiate the WebSocket transport.\nt, _ := websocket.NewTransport(\"ws://localhost:8090\")\n\n// Use the transport to create an RPC client.\nclient, _ := rpc.NewClient(t)\ndefer client.Close()\n\n// Call \"get_config\".\nconfig, _ := client.Database.GetConfig()\n\n// Start processing blocks.\nlastBlock := 1800000\nfor {\n\t// Call \"get_dynamic_global_properties\".\n\tprops, _ := client.Database.GetDynamicGlobalProperties()\n\n\tfor props.LastIrreversibleBlockNum-lastBlock \u003e 0 {\n\t\t// Call \"get_block\".\n\t\tblock, _ := client.Database.GetBlock(lastBlock)\n\n\t\t// Process the transactions.\n\t\tfor _, tx := range block.Transactions {\n\t\t\tfor _, op := range tx.Operations {\n\t\t\t\tswitch body := op.Data().(type) {\n\t\t\t\t\t// Comment operation.\n\t\t\t\t\tcase *types.CommentOperation:\n\t\t\t\t\t\tcontent, _ := client.Database.GetContent(body.Author, body.Permlink)\n\t\t\t\t\t\tfmt.Printf(\"COMMENT @%v %v\\n\", content.Author, content.URL)\n\n\t\t\t\t\t// Vote operation.\n\t\t\t\t\tcase *types.VoteOperation:\n\t\t\t\t\t\tfmt.Printf(\"VOTE @%v @%v/%v\\n\", body.Voter, body.Author, body.Permlink)\n\n\t\t\t\t\t// You can add more cases, it depends on what\n\t\t\t\t\t// operations you actually need to process.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlastBlock++\n\t}\n\n\ttime.Sleep(time.Duration(config.SteemitBlockInterval) * time.Second)\n}\n```\n\n## Package Organisation\n\nYou need to create a `Client` object to be able to do anything. To be able to\ninstantiate a `Client`, you first need to create a transport to be used to\nexecute RPC calls. The WebSocket transport is available in `transports/websocket`.\nThen you just need to call `NewClient(transport)`.\n\nOnce you create a `Client` object, you can start calling the methods exported\nvia `steemd`'s RPC endpoint by invoking associated methods on the client object.\nThere are multiple APIs that can be exported, e.g. `database_api` and `login_api`,\nso the methods on the Client object are also namespaced accoding to these APIs.\nFor example, to call `get_block` from `database_api`, you need to use\n`Client.Database.GetBlock` method.\n\nWhen looking for a method to call, all you need is to turn the method name into\nCamelCase, e.g. `get_config` becomes `Client.Database.GetConfig`.\n\n### Raw and Full Methods\n\nThere are two methods implemented for every method exported via the RPC endpoint.\nThe regular version and the raw version. Let's see an example for `get_config`:\n\n```go\nfunc (client *Client) GetConfig() (*Config, error) {\n\t...\n}\n\nfunc (client *Client) GetConfigRaw() (*json.RawMessage, error) {\n\t...\n}\n```\n\nAs we can see, the difference is that the raw version returns `*json.RawMessage`,\nso it is not trying to unmarshall the response into a properly typed response.\n\nThere are two reasons for this:\n\n1. To be able to see raw data.\n2. To be able to call most of the remote methods even though the response\n   object is not yet known or specified.\n\nIt is already benefitial to just have the raw version because at least\nthe method parameters are statically typed.\n\n## Status\n\nThis package is still under rapid development and it is by no means complete.\nFor now there is no promise considering API stability. Some response objects\nmaybe be typed incorrectly. The package is already usable, though. See the\n`examples` directory.\n\nTo check the API coverate, please check the README files in the relevat API\npackage in the `apis` subdirectory.\n\n## License\n\nMIT, see the `LICENSE` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-steem%2Frpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-steem%2Frpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-steem%2Frpc/lists"}