Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/installers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Installers

on:
pull_request:
push:
branches:
- master

permissions:
contents: read

jobs:
powershell:
name: Windows PowerShell
runs-on: windows-latest

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Test PowerShell installer
shell: pwsh
run: ./scripts/test-install.ps1

shell:
name: ${{ matrix.os }} shell
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Test shell installer
run: sh ./scripts/test-install.sh
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Test
run: go test ./...

- name: Release with GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
version: v2.17.0
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test

on:
pull_request:
push:
branches:
- master

permissions:
contents: read

jobs:
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Test
run: go test ./...

- name: Build CLI
run: go build ./cmd/etherscan

release-config:
name: GoReleaser configuration
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: v2.17.0
install-only: true

- name: Validate snapshot release
run: goreleaser release --snapshot --clean --skip=publish
51 changes: 48 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: 2

project_name: etherscan

report_sizes: true

builds:
- id: etherscan
main: ./cmd/etherscan
Expand All @@ -15,14 +17,57 @@ builds:
goarch:
- amd64
- arm64
flags:
- -trimpath
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
- >-
-s -w
-X main.version={{ .Version }}
-X main.commit={{ .Commit }}
-X main.date={{ .CommitDate }}

archives:
- formats: [tar.gz]
- id: etherscan
ids:
- etherscan
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
formats:
- tar.gz
format_overrides:
- goos: windows
formats: [zip]
formats:
- zip
files:
- README.md
- LICENSE

checksum:
name_template: checksums.txt

snapshot:
version_template: "{{ incpatch .Version }}-next"

changelog:
sort: asc

release:
prerelease: auto

brews:
- name: etherscan
ids:
- etherscan
repository:
owner: etherscan
name: homebrew-etherscan-cli
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
directory: Formula
homepage: "https://github.com/etherscan/etherscan-cli"
description: "Command-line client and interactive explorer for the Etherscan V2 API"
license: MIT
install: |
bin.install "etherscan"
test: |
system "#{bin}/etherscan", "version"
skip_upload: '{{ if index .Env "HOMEBREW_TAP_TOKEN" }}auto{{ else }}true{{ end }}'
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Etherscan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,46 @@ Etherscan's API documentation remains as the main reference for endpoint paramet

## Installation

Download a prebuilt binary from [GitHub Releases](https://github.com/etherscan/etherscan-cli/releases)
### Homebrew (macOS and Linux)

```sh
brew install etherscan/etherscan-cli/etherscan
```

Or tap first, then install:

```sh
brew tap etherscan/etherscan-cli
brew install etherscan
```

### Windows

```powershell
irm https://raw.githubusercontent.com/etherscan/etherscan-cli/master/scripts/install.ps1 | iex
```

### Installation script (macOS and Linux)

```sh
curl -fsSL https://raw.githubusercontent.com/etherscan/etherscan-cli/master/scripts/install.sh | sh
```

The installers select the correct binary, verify its checksum, and add `etherscan` to your `PATH`. Open a new terminal after installation.

### Manual installation

Download the appropriate archive and `checksums.txt` from [GitHub Releases](https://github.com/etherscan/etherscan-cli/releases). Verify the checksum, extract the archive, and place `etherscan` on your `PATH`.

If installation fails, [open a GitHub issue](https://github.com/etherscan/etherscan-cli/issues/new).

### Updating

Update to the latest stable release with:

```sh
etherscan update
```

## Quickstart

Expand Down Expand Up @@ -75,6 +114,7 @@ If `--all` reaches `--max-pages`, the result may be truncated.
| `etherscan login` | Validate and store an API key |
| `etherscan logout` | Remove the stored API key |
| `etherscan uninstall` | Remove all CLI configuration |
| `etherscan update` | Update to the latest stable release |
| `etherscan whoami` | Show the active chain and saved API key |
| `etherscan config` | Get, list, or set CLI configuration |
| `etherscan chains list` | List chains built into this CLI release |
Expand Down Expand Up @@ -217,3 +257,7 @@ If `--all` reaches `--max-pages`, the result may be truncated.
| --- | --- |
| `etherscan apilimit` | [getapilimit](https://docs.etherscan.io/api-reference/endpoint/getapilimit.md) |
<!-- END GENERATED COMMAND INDEX -->

## License

[MIT](LICENSE)
2 changes: 1 addition & 1 deletion cmd/etherscan/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var (
version = "1.0"
version = "dev"
commit = "none"
date = "unknown"
)
Expand Down
Loading