{"id":37106592,"url":"https://github.com/bitvora/go-bitvora","last_synced_at":"2026-01-14T12:50:22.785Z","repository":{"id":257808107,"uuid":"866755964","full_name":"bitvora/go-bitvora","owner":"bitvora","description":"Go SDK for the Bitvora API","archived":false,"fork":false,"pushed_at":"2024-10-03T01:42:01.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-10-03T06:55:12.188Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitvora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-10-02T20:18:26.000Z","updated_at":"2024-10-03T03:13:16.000Z","dependencies_parsed_at":"2024-10-03T07:05:29.788Z","dependency_job_id":null,"html_url":"https://github.com/bitvora/go-bitvora","commit_stats":null,"previous_names":["bitvora/go-bitvora"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/bitvora/go-bitvora","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitvora%2Fgo-bitvora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitvora%2Fgo-bitvora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitvora%2Fgo-bitvora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitvora%2Fgo-bitvora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitvora","download_url":"https://codeload.github.com/bitvora/go-bitvora/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitvora%2Fgo-bitvora/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"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":[],"created_at":"2026-01-14T12:50:22.121Z","updated_at":"2026-01-14T12:50:22.777Z","avatar_url":"https://github.com/bitvora.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitvora Go SDK\n\nThis SDK provides a convenient way to interact with the Bitvora API using the Go programming language. It allows you to manage Bitcoin deposits and withdrawals, create lightning invoices and addresses, and retrieve balance and transaction information.\n\n## Installation\n\nTo install the Bitvora Go SDK, use the following command:\n\n```bash\ngo get github.com/bitvora/go-bitvora\n```\n\n## Usage\n\n### 1. Initialization\n\nFirst, you need to create a `BitvoraClient` instance. You'll need your Bitvora API key and choose either the mainnet or signet network.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/bitvora/go-bitvora\"\n)\n\nfunc main() {\n\tapiKey := \"YOUR_BITVORA_API_KEY\" // Replace with your actual API key\n\tclient := bitvora.NewBitvoraClient(bitvora.Mainnet, apiKey) // Use bitvora.Signet for testnet\n\n\t// ... your Bitvora API calls here ...\n}\n```\n\n### 2. API Calls\n\nThe SDK provides methods for various Bitvora API endpoints:\n\n#### a) Get Balance\n\nRetrieves your Bitvora account balance.\n\n```go\nbalance, err := client.GetBalance()\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"Balance: %d sats\\n\", balance.Data.Balance)\n```\n\n#### b) Get Transactions\n\nRetrieves a list of your transactions.\n\n```go\ntransactions, err := client.GetTransactions()\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"Transactions: %+v\\n\", transactions.Data)\n```\n\n#### c) Withdraw Bitcoin\n\nInitiates a Bitcoin withdrawal. Requires amount, currency, destination address, and optional metadata.\n\n```go\namount := 100.50\ncurrency := bitvora.USD\ndestination := \"bc1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" // chain address, lightning invoice, or lightning address\nmetadata := map[string]string{\"user_id\": \"123\"}\n\nwithdrawal, err := client.Withdraw(amount, currency, destination, metadata)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"Withdrawal successful: %+v\\n\", withdrawal)\n```\n\n#### d) Estimate Withdrawal Fee\n\nEstimates the fee for a Bitcoin withdrawal before actually initiating it.\n\n```go\namount := 1000.0 // Amount in Bitcoin\ncurrency := \"btc\"\ndestination := \"bc1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n\nestimate, err := client.EstimateWithdrawal(amount, currency, destination)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"Withdrawal estimate: %+v\\n\", estimate)\n```\n\n#### e) Create Lightning Invoice\n\nCreates a Lightning invoice.\n\n```go\namount := 1000.0   // Amount in sats\ncurrency := \"sats\"\ndescription := \"Payment for goods\"\nexpirySeconds := 3600 // 1 hour\nmetadata := map[string]string{\"order_id\": \"12345\"}\n\ninvoice, err := client.CreateLightningInvoice(amount, currency, description, expirySeconds, metadata)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"Lightning Invoice: %+v\\n\", invoice)\n```\n\n#### f) Create Lightning Address\n\nCreates a Lightning address.\n\n```go\nhandle := \"my-store\"\ndomain := \"bitvora.com\"\nmetadata := map[string]string{\"description\": \"My Lightning Address\"}\n\naddress, err := client.CreateLightningAddress(handle, domain, metadata)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"Lightning Address: %+v\\n\", address)\n```\n\n#### g) Create On-Chain Address\n\nCreates a new Bitcoin on-chain deposit address.\n\n```go\nmetadata := map[string]string{\"description\": \"On-chain deposit\"}\n\naddress, err := client.CreateOnChainAddress(metadata)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"On-Chain Address: %+v\\n\", address)\n```\n\n#### h) Get Deposit\n\nRetrieves details of a specific deposit using its ID.\n\n```go\ndepositID := \"YOUR_DEPOSIT_ID\" // Replace with the actual deposit ID\ndeposit, err := client.GetDeposit(depositID)\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Printf(\"Deposit details: %+v\\n\", deposit)\n```\n\n#### i) Get Withdrawal\n\nRetrieves details of a specific withdrawal using its ID.\n\n```go\nwithdrawalID := \"YOUR_WITHDRAWAL_ID\" // Replace with the actual withdrawal ID\nwithdrawal, err := client.GetWithdrawal(withdrawalID)\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Printf(\"Withdrawal details: %+v\\n\", withdrawal)\n```\n\n### 3. Error Handling\n\nThe SDK uses custom `APIError` struct to represent errors returned by the Bitvora API. This struct contains the HTTP status code and the response body.\n\n```go\nif err != nil {\n\tapiErr, ok := err.(*bitvora.APIError)\n\tif ok {\n\t\tfmt.Printf(\"Bitvora API error: Status Code=%d, Body=%s\\n\", apiErr.StatusCode, apiErr.Body)\n\t} else {\n\t\tlog.Fatal(err) // Handle other errors\n\t}\n}\n```\n\n## Data Structures\n\nThe SDK defines structs corresponding to the Bitvora API response structures. Refer to the code for detailed information on the fields within each response struct (e.g., `WithdrawResponse`, `GetBalanceResponse`, etc.).\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\n\nThis SDK is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitvora%2Fgo-bitvora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitvora%2Fgo-bitvora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitvora%2Fgo-bitvora/lists"}