{"id":46036750,"url":"https://github.com/myxtype/filecoin-client","last_synced_at":"2026-03-01T05:31:18.750Z","repository":{"id":40639062,"uuid":"290362865","full_name":"myxtype/filecoin-client","owner":"myxtype","description":"Golang的轻量级filecoin客户端，支持离线签名，基本满足钱包交易所充值提现逻辑","archived":false,"fork":false,"pushed_at":"2023-02-15T06:43:38.000Z","size":1014,"stargazers_count":58,"open_issues_count":2,"forks_count":38,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T22:06:46.929Z","etag":null,"topics":["client","filecoin","ipfs","lotus","offline-signature","rpc"],"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/myxtype.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":"2020-08-26T01:21:56.000Z","updated_at":"2024-05-30T10:01:18.000Z","dependencies_parsed_at":"2024-06-18T17:25:44.915Z","dependency_job_id":"03ada24a-7e7b-4628-8069-f67eeafa95da","html_url":"https://github.com/myxtype/filecoin-client","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/myxtype/filecoin-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Ffilecoin-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Ffilecoin-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Ffilecoin-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Ffilecoin-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myxtype","download_url":"https://codeload.github.com/myxtype/filecoin-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Ffilecoin-client/sbom","scorecard":{"id":671607,"data":{"date":"2025-08-11","repo":{"name":"github.com/myxtype/filecoin-client","commit":"f934f03dffdc1b0c2f4ee19511a4cfabddfa4214"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T20:16:15.589Z","repository_id":40639062,"created_at":"2025-08-21T20:16:15.589Z","updated_at":"2025-08-21T20:16:15.589Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29960395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["client","filecoin","ipfs","lotus","offline-signature","rpc"],"created_at":"2026-03-01T05:31:18.176Z","updated_at":"2026-03-01T05:31:18.741Z","avatar_url":"https://github.com/myxtype.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# filecoin-client\n\n[![goproxy.cn](https://goproxy.cn/stats/github.com/myxtype/filecoin-client/badges/download-count.svg)](https://goproxy.cn)\n\n需要自行部署Lotus Node节点：https://lotu.sh/en+getting-started\n\n此库仅添加部分方法，但已经满足钱包充值提现逻辑了，如果需要其他方法，请Fork后自行添加。\n\n充值流程：获取头部高度，从本地高度遍历到头部高度，再根据高度获取区块CID，根据区块CID获取区块的所有消息，判断消息的类型是否0(0为发送Fil)，和接收地址是否是本地的地址。\n\n说明请查询client_test文件。\n\n# 安装\n\n`go get github.com/myxtype/filecoin-client`\n\n# 使用\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"github.com/filecoin-project/go-address\"\n\t\"github.com/myxtype/filecoin-client\"\n)\n\nfunc main() {\n\tclient := filecoin.NewClient(\"http://127.0.0.1:1234/rpc/v0\", \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.cF__3r_0IR9KwZ2nLkqcBW8vuPePruZieJAVvTAoUA4\")\n\n\taddr, _ := address.NewFromString(\"t1e3soclcq34tq7wmykp7xkkmpkzjnghumm3syyay\")\n\tbal, err := client.WalletBalance(context.Background(), addr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprintln(bal.String())\n}\n```\n\n# 离线签名版\n\n公共节点申请：https://infura.io\n\n具体实现逻辑在官方库中：https://github.com/filecoin-project/go-filecoin\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"encoding/hex\"\n\t\"github.com/filecoin-project/go-address\"\n\t\"github.com/filecoin-project/go-state-types/abi\"\n\t\"github.com/myxtype/filecoin-client\"\n\t\"github.com/myxtype/filecoin-client/local\"\n\t\"github.com/myxtype/filecoin-client/types\"\n\t\"github.com/shopspring/decimal\"\n)\n\nfunc main() {\n\t// 设置网络类型\n\taddress.CurrentNetwork = address.Mainnet\n\n\t// 生产新的地址\n\t// 新地址有转入fil才激活，不然没法用\n\tki, addr, err := local.WalletNew(types.KTSecp256k1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprintln(hex.EncodeToString(ki.PrivateKey))\n\tprintln(addr.String())\n\n\t// 50a5e6234f5fdfc026bd889347409e11b6ef5b6034a7b0572d7e24ed1e9ba0e4\n\t// f1dynqskhlixt5eswpff3a72ksprqmeompv3pbesy\n\n\tto, _ := address.NewFromString(\"f1yfi4yslez2hz3ori5grvv3xdo3xkibc4v6xjusy\")\n\n\t// 转移0.001FIL到f1yfi4yslez2hz3ori5grvv3xdo3xkibc4v6xjusy\n\tmsg := \u0026types.Message{\n\t\tVersion:    0,\n\t\tTo:         to,\n\t\tFrom:       *addr,\n\t\tNonce:      0,\n\t\tValue:      filecoin.FromFil(decimal.NewFromFloat(0.001)),\n\t\tGasLimit:   0,\n\t\tGasFeeCap:  abi.NewTokenAmount(10000),\n\t\tGasPremium: abi.NewTokenAmount(10000),\n\t\tMethod:     0,\n\t\tParams:     nil,\n\t}\n\n\tclient := filecoin.New(\"https://1lB5G4SmGdSTikOo7l6vYlsktdd:b58884915362a99b4fc18c2bf8af8358@filecoin.infura.io\")\n\n\t// 最大手续费0.0001 FIL\n\t//maxFee := filecoin.FromFil(decimal.NewFromFloat(0.0001))\n\n\t// 估算GasLimit\n\t//msg, err = client.GasEstimateMessageGas(context.Background(), msg, \u0026types.MessageSendSpec{MaxFee: maxFee}, nil)\n\t//if err != nil {\n\t//\tpanic(err)\n\t//}\n\n\t// 离线签名\n\ts, err := local.WalletSignMessage(types.KTSecp256k1, ki.PrivateKey, msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprintln(hex.EncodeToString(s.Signature.Data))\n\t// 47bcbb167fd9040bd02dba02789bc7bc0463c290db1be9b07065c12a64fb84dc546bef7aedfba789d0d7ce2c4532f8fa0d2dd998985ad3ec1a8b064c26e4625a01\n\n\t// 验证签名\n\tif err := local.WalletVerifyMessage(s); err != nil {\n\t\tpanic(err)\n\t}\n\n\tmid, err := client.MpoolPush(context.Background(), s)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprintln(mid.String())\n}\n\n```\n\n\u003e 暂时不支持`bls`类型，仅支持`secp256k1`，所以离线签名所有类型请选择`types.KTSecp256k1`\n\n\u003e 私钥存储在数据库请进行加密存储，建议进行AES加密，将AES密钥放在代码中，别放配置文件，编译到执行文件中。\n\n# Util\n\nutil.go 中提供FIL小数与大数之间的转换，但没有严格测试，请小心使用。\n\n# 充值流程\n\n参见：/examples/recharge\n\n# Lotus文档\n\nhttps://lotu.sh/en+api-methods\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyxtype%2Ffilecoin-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyxtype%2Ffilecoin-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyxtype%2Ffilecoin-client/lists"}