-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ac3a752
Showing
95 changed files
with
29,174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
check-latest: true | ||
- uses: technote-space/[email protected] | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- run: | | ||
make build | ||
# Check only if there are differences in the source code | ||
if: env.GIT_DIFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- feat/* | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
skip-pkg-cache: true | ||
go-version: "1.20" | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/[email protected] | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- uses: golangci/[email protected] | ||
with: | ||
skip-pkg-cache: true | ||
args: --timeout=3m | ||
version: latest | ||
# Check only if there are differences in the source code | ||
if: "env.GIT_DIFF" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
vue/node_modules | ||
vue/dist | ||
release/ | ||
.idea/ | ||
.vscode/ | ||
.DS_Store | ||
|
||
# Build | ||
build | ||
|
||
|
||
# Local docker volume mappings | ||
.testnets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM golang:1.20-bullseye as builder | ||
|
||
# Install minimum necessary dependencies | ||
ENV PACKAGES curl make git libc-dev bash gcc | ||
RUN apt-get update && apt-get upgrade -y && \ | ||
apt-get install -y $PACKAGES | ||
|
||
# Set working directory for the build | ||
WORKDIR /src/app/ | ||
|
||
# Add source files | ||
COPY . . | ||
|
||
# build | ||
RUN make install | ||
|
||
# Final image | ||
FROM golang:1.20-bullseye as final | ||
|
||
WORKDIR / | ||
|
||
RUN apt-get update && apt-get install -y jq | ||
|
||
# Copy over binaries from the build-env | ||
COPY --from=builder /go/bin/ottod / | ||
|
||
EXPOSE 26656 26657 1317 9090 8545 8546 | ||
|
||
ENTRYPOINT ["/bin/bash", "-c"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#!/usr/bin/make -f | ||
|
||
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') | ||
VERSION ?= $(shell echo $(shell git describe --tags --always) | sed 's/^v//') | ||
TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::') | ||
COMMIT := $(shell git log -1 --format='%H') | ||
LEDGER_ENABLED ?= true | ||
OTTO_BINARY = ottod | ||
BUILDDIR ?= $(CURDIR)/build | ||
|
||
export GO111MODULE = on | ||
|
||
# process build tags | ||
|
||
build_tags = netgo | ||
ifeq ($(LEDGER_ENABLED),true) | ||
ifeq ($(OS),Windows_NT) | ||
GCCEXE = $(shell where gcc.exe 2> NUL) | ||
ifeq ($(GCCEXE),) | ||
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false) | ||
else | ||
build_tags += ledger | ||
endif | ||
else | ||
UNAME_S = $(shell uname -s) | ||
ifeq ($(UNAME_S),OpenBSD) | ||
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988)) | ||
else | ||
GCC = $(shell command -v gcc 2> /dev/null) | ||
ifeq ($(GCC),) | ||
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false) | ||
else | ||
build_tags += ledger | ||
endif | ||
endif | ||
endif | ||
endif | ||
|
||
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS))) | ||
build_tags += gcc | ||
endif | ||
build_tags += $(BUILD_TAGS) | ||
build_tags := $(strip $(build_tags)) | ||
|
||
# process linker flags | ||
|
||
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=otto \ | ||
-X github.com/cosmos/cosmos-sdk/version.AppName=$(OTTO_BINARY) \ | ||
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ | ||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ | ||
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION) | ||
|
||
# DB backend selection | ||
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS))) | ||
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb | ||
endif | ||
|
||
# add build tags to linker flags | ||
whitespace := $(subst ,, ) | ||
comma := , | ||
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) | ||
ldflags += -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" | ||
|
||
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS))) | ||
ldflags += -w -s | ||
endif | ||
ldflags += $(LDFLAGS) | ||
ldflags := $(strip $(ldflags)) | ||
|
||
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' | ||
# check for nostrip option | ||
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS))) | ||
BUILD_FLAGS += -trimpath | ||
endif | ||
|
||
# check if no optimization option is passed | ||
# used for remote debugging | ||
ifneq (,$(findstring nooptimization,$(COSMOS_BUILD_OPTIONS))) | ||
BUILD_FLAGS += -gcflags "all=-N -l" | ||
endif | ||
|
||
# # The below include contains the tools and runsim targets. | ||
# include contrib/devtools/Makefile | ||
|
||
############################################################################### | ||
### Build ### | ||
############################################################################### | ||
|
||
BUILD_TARGETS := build install | ||
|
||
build: BUILD_ARGS=-o $(BUILDDIR)/ | ||
|
||
$(BUILD_TARGETS): go.sum $(BUILDDIR)/ | ||
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./... | ||
|
||
$(BUILDDIR)/: | ||
mkdir -p $(BUILDDIR)/ | ||
|
||
build-linux: go.sum | ||
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build | ||
|
||
go.sum: go.mod | ||
@echo "--> Ensure dependencies have not been modified" | ||
@go mod verify | ||
|
||
clean: | ||
rm -rf $(BUILDDIR)/ artifacts/ | ||
|
||
.PHONY: build clean | ||
|
||
############################################################################### | ||
### Localnet ### | ||
############################################################################### | ||
|
||
# Build image for a local testnet | ||
localnet-build: | ||
docker build --no-cache --tag otto/node -f Dockerfile . | ||
|
||
# Start a 4-node testnet locally | ||
localnet-start: localnet-clean build-linux localnet-build | ||
@if ! [ -f build/node0/$(OTTO_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/otto:Z otto/node "./ottod testnet init-files --v 3 -o /otto --keyring-backend=test --starting-ip-address 192.167.10.2"; fi; \ | ||
scripts/setup_genesis.sh; \ | ||
docker compose up -d; | ||
|
||
# Stop testnet | ||
localnet-stop: | ||
docker compose down | ||
|
||
# Clean testnet | ||
localnet-clean: | ||
docker compose down | ||
sudo rm -rf build/* | ||
|
||
# Show logs | ||
localnet-show-logstream: | ||
docker compose logs --tail=1000 -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# OttoChain | ||
|
||
**OttoChain** is a scalable PoS blockchain that is fully compatible and interoperable with the EVM. It is built using the Cosmos SDK which runs on top of the CometBFT consensus engine, to accomplish fast finality, high transaction throughput and short block times (~2 seconds). | ||
|
||
## OttoChain Testnet | ||
|
||
* Chain Name: OttoChain | ||
* Cosmos Chain ID: `otto_9100-1` | ||
* EVM Chain ID (EIP155 Number): `9100` | ||
* JSON RPC: `https://gateway.testnet.octopus.network/ottochain/m4k5urt9h33dpbhgsp4lqxemo6naeihz` | ||
* [Explorer](http://34.69.4.240:4000/) | ||
* [Faucet](http://34.69.4.240:8088/) | ||
* Genesis File: [genesis.json](https://raw.githubusercontent.com/octopus-network/oyster/ocb-otto/genesis.json) | ||
* Persistent Peers: | ||
```json | ||
persistent_peers = "[email protected]:26656, [email protected]:26656" | ||
``` | ||
|
||
## Run Multi Node | ||
|
||
To build start a 4 node testnet using docker, run: | ||
|
||
```bash | ||
make localnet-start | ||
``` | ||
|
||
### Watch Logs | ||
|
||
You can watch logs, run: | ||
|
||
```bash | ||
make localnet-show-logstream | ||
``` | ||
|
||
You can also watch logs via Docker with the `-f` flag, for example: | ||
|
||
```bash | ||
docker logs -f ottonode0 | ||
``` | ||
|
||
### Interact with the Localnet | ||
|
||
You can send some curl commands such as: | ||
|
||
```bash | ||
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],"id":1}' -H "Content-Type: application/json" http://127.0.0.1:8545 | ||
``` | ||
|
||
```json | ||
{"jsonrpc":"2.0","id":1,"result":"0x47fbaaa9287f72dbe2465469b4e71d5a"} | ||
``` | ||
|
||
```bash | ||
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x47fbaaa9287f72dbe2465469b4e71d5a"],"id":1}' -H "Content-Type: application/json" http://127.0.0.1:8545 | ||
``` | ||
|
||
```json | ||
{"jsonrpc":"2.0","id":1,"result":["0x5c7be43735b901f41c9aa0c7340c99462f490104cfb8dc14d7fb0a33e15e46c2","0x7bb4eacdf8de04a86ec127b1a4417a38199094754a6e4560610ca2c11b1bfd57","0x1269fd687598334ae734bc24559b8e71dfc1525fdae86ceb3c439d2f4c2a7532","0x434b5ac65b607c8a910fc4f4d589818f4144bc64de638a82ceb24509ddfeac59","0xb26ef28098aa5cdaec6f58b267a8d2806770e46282131ff00b9f52d901c343e5","0xec87d067ea62730db4b0a2b3edcb462bad041c358971de3e5fd11c69761a2f9e","0x9c6f443ee54811d28cc1b903564f7fdbfd3372613cfbd55eddfc23a3205784df","0x83fe4eb6af26523f5675474053ae99d8369afed28bff7de6be727c8062ce53a3","0xdcc146c9d21a10b119397d98658c3d2bc4231c79cc3892d0070c0377308e9fdd","0x4a20b02aaa26846eecf646e606f39641acae52e4d66926dbc8585e406af50452","0x749ac740da8ea608eb293620a8a90b4c30a1fa7036975f07421c41b3cf0f48ca","0xdabcd4e8c672c3536e8cba7b480710a113de246ef679016033109bb1ca2bf405","0xd91373c0eea02653479c02e13d309441c0ff884a5e9b7a6ea0711a3e08c9ed59","0x7ac9e220458c3e7d273583505069385d8f0caf68763adb54744ea1ce449d0d24","0xad9de6812c8fcf292e14c0e4fe7099fdcb39677a9ff0df24862bf8a44b3812d5","0x3c491a7946d6b87e3bc69a7643e195795320e5bab3568bbfea444b93847081db","0x58d49ef24729a20f78047a6d230860ea427b58d300517368ab555db40b2c9309","0xbb24017c97487d554e82b876529c3fbf9e801eaf8105fe57b9414cb24b03fbb8"]} | ||
``` | ||
|
||
## Tutorial | ||
|
||
[Hardhat Tutorial](./tutorial/README.md) |
Oops, something went wrong.