{"id":36492306,"url":"https://github.com/boolw/go-web3","last_synced_at":"2026-01-12T01:57:08.158Z","repository":{"id":57559619,"uuid":"324909458","full_name":"boolw/go-web3","owner":"boolw","description":"Ethereum Golang  jsonrpc API contract ABI encode decode","archived":false,"fork":false,"pushed_at":"2024-07-30T07:23:25.000Z","size":163,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-30T10:34:54.711Z","etag":null,"topics":["ethereum","ethereum-contract","jsonrpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boolw.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":"2020-12-28T04:14:29.000Z","updated_at":"2024-07-30T07:18:57.000Z","dependencies_parsed_at":"2022-08-28T14:10:56.992Z","dependency_job_id":null,"html_url":"https://github.com/boolw/go-web3","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/boolw/go-web3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolw%2Fgo-web3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolw%2Fgo-web3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolw%2Fgo-web3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolw%2Fgo-web3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boolw","download_url":"https://codeload.github.com/boolw/go-web3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolw%2Fgo-web3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ethereum","ethereum-contract","jsonrpc"],"created_at":"2026-01-12T01:57:07.632Z","updated_at":"2026-01-12T01:57:08.146Z","avatar_url":"https://github.com/boolw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Go-Web3\nfork: https://github.com/umbracle/go-web3\ncommit: e3fe470083504f038262bcd073fa49e4908320dc\n\n# Contract parse tool\nDemo: https://abi.yiew.cn\n\n## JsonRPC\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\n\tweb3 \"github.com/boolw/go-web3\"\n\t\"github.com/boolw/go-web3/jsonrpc\"\n)\n\nfunc main() {\n\tclient, err := jsonrpc.NewClient(\"https://mainnet.infura.io\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tnumber, err := client.Eth().BlockNumber()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\theader, err := client.Eth().GetBlockByNumber(web3.BlockNumber(number), true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(header)\n}\n```\n\n## ABI\n\nThe ABI codifier uses randomized tests with e2e integration tests with a real Geth client to ensure that the codification is correct and provides the same results as the AbiEncoder from Solidity. \n\nTo use the library import:\n\n```\n\"github.com/boolw/go-web3/abi\"\n```\n\nDeclare basic objects:\n\n```\ntyp, err := abi.NewType(\"uint256\")\n```\n\nor \n\n```\ntyp = abi.MustNewType(\"uint256\")\n```\n\nand use it to encode/decode the data:\n\n```\nnum := big.NewInt(1)\n\nencoded, err := typ.Encode(num)\nif err != nil {\n    panic(err)\n}\n\ndecoded, err := typ.Decode(num) // decoded as interface\nif err != nil {\n    panic(err)\n}\n\nnum2 := decoded.(*big.Int)\nfmt.Println(num.Cmp(num2) == 0) // num == num2\n```\n\nYou can also codify structs as Solidity tuples:\n\n```\nimport (\n\t\"fmt\"\n    \n\tweb3 \"github.com/boolw/go-web3\"\n\t\"github.com/boolw/go-web3/abi\"\n\t\"math/big\"\n)\n\nfunc main() {\n\ttyp := abi.MustNewType(\"tuple(address a, uint256 b)\")\n\n\ttype Obj struct {\n\t\tA web3.Address\n\t\tB *big.Int\n\t}\n\tobj := \u0026Obj{\n\t\tA: web3.Address{0x1},\n\t\tB: big.NewInt(1),\n\t}\n\n\t// Encode\n\tencoded, err := typ.Encode(obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Decode output into a map\n\tres, err := typ.Decode(encoded)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Decode into a struct\n\tvar obj2 Obj\n\tif err := typ.DecodeStruct(encoded, \u0026obj2); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(res)\n\tfmt.Println(obj)\n}\n```\n\n## ENS\n\nResolve names on the Ethereum Name Service registrar.\n\n```\nimport (\n    \"fmt\"\n\n    web3 \"github.com/boolw/go-web3\"\n    \"github.com/boolw/go-web3/jsonrpc\"\n    \"github.com/boolw/go-web3/contract/builtin/ens\"\n)\n\nvar mainnetAddress = web3.HexToAddress(\"0x314159265dD8dbb310642f98f50C066173C1259b\")\n\nfunc main() {\n\tclient, err := jsonrpc.NewClient(\"https://mainnet.infura.io\")\n    if err != nil {\n        panic(err)\n    }\n\n\tresolver := ens.NewENSResolver(mainnetAddress, client)\n\taddr, err := resolver.Resolve(\"ens_address\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n    fmt.Println(addr)\n}\n```\n\n## Tracker\n\nComplete example of the tracker [here](./tracker/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboolw%2Fgo-web3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboolw%2Fgo-web3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboolw%2Fgo-web3/lists"}