{"id":20841349,"url":"https://github.com/iotexproject/iotex-proto","last_synced_at":"2025-05-08T22:09:11.986Z","repository":{"id":35142158,"uuid":"184818205","full_name":"iotexproject/iotex-proto","owner":"iotexproject","description":"Protobuf definition for IoTeX transactions, blocks, chain and APIs!","archived":false,"fork":false,"pushed_at":"2024-10-17T22:32:16.000Z","size":1090,"stargazers_count":11,"open_issues_count":2,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-08T22:08:51.854Z","etag":null,"topics":[],"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/iotexproject.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":"2019-05-03T20:45:54.000Z","updated_at":"2025-04-22T20:29:19.000Z","dependencies_parsed_at":"2024-02-01T04:29:25.022Z","dependency_job_id":"1eb303dd-a4c3-4406-aac8-81bf3776db02","html_url":"https://github.com/iotexproject/iotex-proto","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotexproject%2Fiotex-proto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotexproject%2Fiotex-proto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotexproject%2Fiotex-proto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotexproject%2Fiotex-proto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iotexproject","download_url":"https://codeload.github.com/iotexproject/iotex-proto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253154975,"owners_count":21862622,"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":[],"created_at":"2024-11-18T01:19:45.903Z","updated_at":"2025-05-08T22:09:11.969Z","avatar_url":"https://github.com/iotexproject.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iotex-proto\nProtobuf and utility package for IoTeX blockchain transaction and gRPC API\n\n- `\\proto` includes protobuf definition for all core data objects and gRPC API used by IoTeX blockchain\n\n- `\\golang` includes the generated protobuf files for go language\n\n# Getting Started\n## Installing\n### Install protoc\nInstall the Google protocol buffers compiler `protoc` v3.12.0 or above from https://github.com/protocolbuffers/protobuf/releases\n\nInstall protoc-gen-go\n```\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest\ngo install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest\n```\n\nEnable go mod. Install grpc-gateway https://github.com/grpc-ecosystem/grpc-gateway. Basically this is what you need:\n\n```\ngo get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway\ngo get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger\n```\n\n### Install mockgen\nInstall golang mock generator `mockgen` v1.4.4 or above to generate mock files.\n\n```\ngo get -u github.com/golang/mock/mockgen\n```\n\n## Compiling\n```\nmake gen\n```\nThis generates the protobuf files and put into \\golang directory\n\n## Sign IoTeX blockchain transaction\nsecp256k1 ECDSA algorithm is used by IoTeX blockchain to sign and verify transaction. The signature of an IoTeX transaction is computed as the secp256k1 signature of hash of raw transaction\n```\nsignature = secp256k1.Sign(hash of raw transaction)\n```\nThe signature is in 65-byte [R, S, V] format where the last byte V is the recovery id for public key recovery\n\nThe following guide used sender address `io1mwekae7qqwlr23220k5n9z3fmjxz72tuchra3m` and recipient address `io187wzp08vnhjjpkydnr97qlh8kh0dpkkytfam8j` as example. Replace your actual address and recipient address when creating and signing the transaction\n\n### Create raw transaction\n1. construct a message Transfer as defined in `\\proto\\type\\action.proto`, amount is in unit of 10^-18 IOTX token\n\nFor example, to transfer 1.2 IOTX token, set amount = “1200000000000000000”\n\nSet recipient = \"io187wzp08vnhjjpkydnr97qlh8kh0dpkkytfam8j\"\n\npayload = hex-bytes of message you want to attach to transaction, can be nil/NULL\n\n2. construct a message ActionCore as defined in `\\proto\\type\\action.proto`, with action = transfer message in 1\n\nSet version = 1, gasLimit = 10000, gasPrice = 1000000000000, that is 0.000001 IOTX\n\nFor nonce, issue a gRPC request GetAccount(GetAccountRequest) as defined in `\\proto\\api\\api.proto` use the value of \"pendingNonce\" field in the reply\n\n### Sign raw transaction\n1. serialize the ActionCore message using protobuf\n```\nbytes = proto.Serialize(ActionCore message above)\n```\n2. hash of raw transaction is computed as the 32-byte Keccak256 hash of the bytes\n```\nhash = Keccak256(bytes)\n```\n3. sign the hash using sender's private key\n```\nsig = secp256k1.Sign(hash)\n```\n\n### Send signed transaction to IoTeX blockchain\n1. construct a message Action as defined in \\proto\\type\\action.proto\n\nSet action = ActionCore above, senderPubKey = bytes representation of sender's public key, signature = sig above\n\n2. issue a gRPC request SendAction(SendActionRequest) to IoTeX blockchain endpoint\n\n### Go example\n\nThe examples folder contains a few [examples](golang/examples) demonstrating functionality.\n\nTo run an example, navigate to it's directory, then go run the file. For example:\n\n```\n$ cd golang/examples/transfer\n$ go run main.go\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiotexproject%2Fiotex-proto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiotexproject%2Fiotex-proto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiotexproject%2Fiotex-proto/lists"}