Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/blockcypher/gobcy/v2
A Go wrapper for the BlockCypher API. Targeting support for Bitcoin (main and testnet3) and BlockCypher's internal testnet, but others (Litecoin, Dogecoin) should work too. The wrapper works also for some query for Ethereum but the compatibility is not fully guaranteed.
Import the package like so:
import "github.com/blockcypher/gobcy/v2"
Then initiate an API struct with your credentials:
//explicitly
bc := gobcy.API{}
bc.Token = "your-api-token-here"
bc.Coin = "btc" //options: "btc","bcy","ltc","doge","eth"
bc.Chain = "main" //depending on coin: "main","test3","test"
//using a struct literal
bc := gobcy.API{"your-api-token-here","btc","main"}
//query away
fmt.Println(bc.GetChain())
fmt.Println(bc.GetBlock(300000,"",nil))
Check the "types.go" file for information on the return types. Almost all API calls are supported, with a few dropped to reduce complexity. If an API call supports URL parameters, it will likely appear as a params map[string]string
variable in the API method. You can check the docs for supported URL flags.
Speaking of API docs, you can check out BlockCypher's documentation here. We've also heavily commented the code following Golang convention, so you might also find the GoDoc quite useful. The gobcy_test.go
file also shows most of the API calls in action.
The aforementioned gobcy_test.go
file contains a number of tests to ensure the wrapper is functioning properly. If you run it yourself, you'll have to insert a valid API token; you may also want to generate a new token, as the test POSTs and DELETEs WebHooks and Payment Forwarding requests.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.