├── .gitignore ├── seeds ├── .circleci └── config.yml ├── Makefile ├── .github └── ISSUE_TEMPLATE │ ├── custom-issue.md │ ├── feature_request.md │ └── bug_report.md ├── cmd ├── galaxyd │ ├── build.sh │ └── main.go └── galaxycli │ ├── build.sh │ └── main.go ├── Gopkg.toml ├── docs ├── events.md ├── build-instructions.md ├── scrum.md ├── manual-install.md ├── getting-started.md ├── community.md ├── roadmap.md └── CONTRIBUTING.md ├── genesis.json ├── LICENSE.md ├── types └── account.go ├── app ├── app_test.go └── app.go ├── install-mac.sh ├── install.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Gopkg.lock 2 | vendor 3 | bin 4 | -------------------------------------------------------------------------------- /seeds: -------------------------------------------------------------------------------- 1 | a0cd321854769978eea1ffb57d341ecaf6551905@149.28.45.92:26656,ea7ff5667f65c52e8c673bc96885a66fe6c1ec7b@98.118.185.162:26656,642f7a68f1af520a1b05134382fe97ba7513ee41@45.77.36.79:26656 2 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: /go/src/github.com/CircleCI-Public/circleci-demo-go 5 | docker: 6 | - image: circleci/golang:1.8 7 | steps: 8 | - checkout 9 | - run: echo "hello world" -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PACKAGES=$(shell go list ./... | grep -v '/vendor/') 2 | 3 | all: get_tools get_vendor_deps build test 4 | 5 | get_tools: 6 | go get github.com/golang/dep/cmd/dep 7 | 8 | build: 9 | go build -o bin/galaxycli cmd/galaxycli/main.go && go build -o bin/galaxyd cmd/galaxyd/main.go 10 | 11 | get_vendor_deps: 12 | @rm -rf vendor/ 13 | @dep ensure 14 | 15 | test: 16 | @go test $(PACKAGES) 17 | 18 | benchmark: 19 | @go test -bench=. $(PACKAGES) 20 | 21 | .PHONY: all build test benchmark -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue 3 | about: This template is for custom issues 4 | 5 | --- 6 | 7 | **Description** 8 | Please provide a short and descriptive example title 9 | 10 | A summary of the issue If suitable, include the tasks required for the issue. 11 | 12 | **Tasks** 13 | 1. This is the first task 14 | 2. This is the second task 15 | 3. Further tasks, etc. 16 | 17 | Any other information you want to share that is relevant to the issue. This might include the lines of code, screenshots, imagery, links, solutions, opinions, feedback, etc. 18 | -------------------------------------------------------------------------------- /cmd/galaxyd/build.sh: -------------------------------------------------------------------------------- 1 | # Cross compiles for myriad platforms 2 | gox 3 | # Removes FreeBSD, OpenBSD, Windows386, Mac386, s390x 4 | rm galaxyd_freebsd* galaxyd_linux_m* galaxyd_openbsd_* galaxyd_windows_386* galaxyd_linux_s390x galaxyd_darwin_386 5 | # Moves binaries to match uname -m 6 | mv galaxyd_darwin_amd64 galaxyd_darwin_x86_64 7 | mv galaxyd_linux_386 galaxyd_linux_x86 8 | mv galaxyd_linux_amd64 galaxyd_linux_x86_64 9 | mv galaxyd_linux_arm galaxyd_linux_armv7l 10 | # Builds for Pi W Zero, original Pi 11 | env GOOS=linux GOARCH=arm GOARM=5 go build 12 | mv galaxyd galaxyd_linux_armv6l 13 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | [[constraint]] 2 | name = "github.com/spf13/viper" 3 | version = "=1.0.0" 4 | 5 | [[constraint]] 6 | name = "github.com/cosmos/cosmos-sdk" 7 | version = "=0.22.0" 8 | 9 | [[constraint]] 10 | name = "github.com/stretchr/testify" 11 | version = "=1.2.1" 12 | 13 | [[constraint]] 14 | name = "github.com/spf13/cobra" 15 | version = "=0.0.1" 16 | 17 | [[override]] 18 | name = "github.com/golang/protobuf" 19 | version = "=1.1.0" 20 | 21 | [[override]] 22 | name = "github.com/tendermint/tendermint" 23 | version = "=0.22.0" 24 | 25 | [prune] 26 | go-tests = true 27 | unused-packages = true -------------------------------------------------------------------------------- /cmd/galaxycli/build.sh: -------------------------------------------------------------------------------- 1 | # Cross compiles for myriad platforms 2 | gox 3 | # Removes FreeBSD, OpenBSD, Windows386, Mac386, s390x 4 | rm galaxycli_freebsd* galaxycli_linux_m* galaxycli_openbsd_* galaxycli_windows_386* galaxycli_linux_s390x galaxycli_darwin_386 5 | # Moves binaries to match uname -m 6 | mv galaxycli_darwin_amd64 galaxycli_darwin_x86_64 7 | mv galaxycli_linux_386 galaxycli_linux_x86 8 | mv galaxycli_linux_amd64 galaxycli_linux_x86_64 9 | mv galaxycli_linux_arm galaxycli_linux_armv7l 10 | # Builds for Pi W Zero, original Pi 11 | env GOOS=linux GOARCH=arm GOARM=5 go build 12 | mv galaxycli galaxycli_linux_armv6l 13 | -------------------------------------------------------------------------------- /docs/events.md: -------------------------------------------------------------------------------- 1 | # Events 2 | 3 | Here you can find information on the latest Galaxy and industry related events. 4 | 5 | _Galaxy community events coming soon!_ 6 | 7 | ## Upcoming events 8 | * Sep 13 - 14, 2018 - **Boston, US** -- [Token Fest Boston 2018](https://tokenfest.io/) 9 | * Sep 26, 2018 - **Toronto, ON** -- [Rebooting Web of Trust VII](https://www.eventbrite.com/e/rebooting-the-web-of-trust-vii-fall-2018-toronto-on-ca-tickets-48527570269?utm-medium=discovery&utm-campaign=social&utm-content=attendeeshare&aff=escb&utm-source=cp&utm-term=listing) 10 | 11 | 12 |
13 | ^ back to top 14 |
-------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /docs/build-instructions.md: -------------------------------------------------------------------------------- 1 | # Galaxy Build Instructions 2 | 3 | ## Building Galaxy! 4 | 5 | Building Galaxy, even for a multiplatform environment, is pretty easy. 6 | 7 | 1) Install Go 8 | 2) `go get github.com/galaxypi/galaxy` 9 | 3) cd $GOPATH/github.com/galaxypi/galaxy 10 | 4) make 11 | 12 | .... will cover it for the platform you're currently using. 13 | 14 | ## Building Galaxy for Everything: 15 | 16 | 1) Follow the directions above 17 | 2) `go get github.com/mitchellh/gox` -- Gox is a multiplatform build tool that we use to build galaxy for almost everything, all at once. 18 | 3) cd $GOPATH/src/github.com/galaxypi/galaxy/cmd/galaxyd 19 | 4) sh build.sh 20 | 5) cd $GOPATH/src/github.com/galaxypi/galaxy/cmd/galaxycli 21 | 6) sh build.sh 22 | 23 | This will leave you with multiplatform binaries in the galaxyd folder and galaxycli folder. You can use those binaries on devices of your choosing. Also, please know that build.sh filters certain platforms. Look into it to see platforms that you can enable. 24 | -------------------------------------------------------------------------------- /genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "genesis_time": "2018-07-26T01:16:33.808737742Z", 3 | "chain_id": "test-chain-4leziZ", 4 | "consensus_params": { 5 | "block_size_params": { 6 | "max_bytes": "22020096", 7 | "max_txs": "10000", 8 | "max_gas": "-1" 9 | }, 10 | "tx_size_params": { 11 | "max_bytes": "10240", 12 | "max_gas": "-1" 13 | }, 14 | "block_gossip_params": { 15 | "block_part_size_bytes": "65536" 16 | }, 17 | "evidence_params": { 18 | "max_age": "100000" 19 | } 20 | }, 21 | "validators": [ 22 | { 23 | "pub_key": { 24 | "type": "tendermint/PubKeyEd25519", 25 | "value": "IPdXDVlKjzD+QbemVRo8xp4BQAG2st+m5Lnjr7VPbXg=" 26 | }, 27 | "power": "10", 28 | "name": "" 29 | } 30 | ], 31 | "app_hash": "", 32 | "app_state": { 33 | "accounts": [ 34 | { 35 | "address": "cosmosaccaddr16vr58j4hjggkjevtu7pt3sugw25krv8c3t7vfy", 36 | "coins": [ 37 | { 38 | "denom": "mycoin", 39 | "amount": "9007199254740992" 40 | } 41 | ] 42 | } 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Galaxy Pi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/scrum.md: -------------------------------------------------------------------------------- 1 | # Scrum 2 | 3 | The Galaxy community participates in [daily scrum](#daily-scrum) standups and [weekly scrum](#weekly-scrum) community calls. All scrum events are on the [Galaxy Discord](https://discord.gg/36K9nan) chat room. 4 | 5 | 6 |
7 | ^ back to top 8 |
9 | 10 | 11 | ## Daily scrum 12 | 13 | To view and/or participate in the daily scrum written standups, follow the steps below: 14 | 15 | 1. Join the official [Galaxy Discord](https://discord.gg/36K9nan) chat room. 16 | 2. Visit the #standup channel. 17 | 18 |
19 | ^ back to top 20 |
21 | 22 | 23 | ## Weekly scrum 24 | 25 | The following is an ongoing list of items discussed during the weekly community scrum calls. 26 | 27 | Everyone is welcome to join in on weekly calls. 28 | 29 | To join the next weekly scrum call, follow the steps below: 30 | 31 | 1. Join the official [Galaxy Discord](https://discord.gg/36K9nan) chat room. 32 | 2. Visit the #community channel and ask when the next call is. 33 | 34 |
35 | ^ back to top 36 |
37 | 38 | 39 | ### Past calls 40 | 41 | n/a 42 | 43 |
44 | ^ back to top 45 |
-------------------------------------------------------------------------------- /docs/manual-install.md: -------------------------------------------------------------------------------- 1 | # Manually install Galaxy 2 | 3 | If you'd like, you can choose to manually install Galaxy as a option to the above. To do so, follow the following instructions otherwise see the recommended [Getting started](/docs/getting-started.md) page for more detailed information on installing and syncing Galaxy. 4 | 5 | 1. Download the one of the [Galaxy binaries](https://github.com/galaxypi/galaxy/releases) that matches your Operating system and processor. 6 | 7 | 2. Chosee the PATH to the binary. i.e. `/usr/bin` 8 | ``` 9 | NOTE: You may need to chmod +x the binaries that you copy to some place on your path. 10 | ``` 11 | 12 | 3. Initialize Galaxy 13 | ``` 14 | galaxyd init 15 | ``` 16 | 17 | 4. Download the genesis block 18 | ``` 19 | wget -O ~/.galaxyd/config/genesis.json https://github.com/galaxypi/galaxy/raw/master/genesis.json 20 | ``` 21 | 22 | 5. Configure Galaxy 23 | ``` 24 | # Navigate to the config directory 25 | cd ~/.galaxyd/config 26 | # Open the config file 27 | nano config.toml 28 | # Find 'moniker' & rename your Galaxy node 29 | moniker = 30 | ``` 31 | 32 | 6. Add seeds 33 | ``` 34 | # Find 'seeds' & replace with the following 35 | seeds = "a0cd321854769978eea1ffb57d341ecaf6551905@149.28.45.92:26656" 36 | ``` 37 | 38 | 7. Save and quit your nano file 39 | ``` 40 | # Save the file 41 | crtl+o 42 | # Quit nano 43 | ctrl+x 44 | 45 | 8. Run Galaxy 46 | ``` 47 | galaxyd start 48 | ``` 49 | -------------------------------------------------------------------------------- /cmd/galaxyd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "io" 6 | "os" 7 | 8 | "github.com/cosmos/cosmos-sdk/baseapp" 9 | 10 | "github.com/galaxypi/galaxy/app" 11 | "github.com/cosmos/cosmos-sdk/server" 12 | "github.com/spf13/cobra" 13 | "github.com/spf13/viper" 14 | abci "github.com/tendermint/tendermint/abci/types" 15 | "github.com/tendermint/tendermint/libs/cli" 16 | dbm "github.com/tendermint/tendermint/libs/db" 17 | "github.com/tendermint/tendermint/libs/log" 18 | tmtypes "github.com/tendermint/tendermint/types" 19 | ) 20 | 21 | func main() { 22 | cdc := app.MakeCodec() 23 | ctx := server.NewDefaultContext() 24 | 25 | rootCmd := &cobra.Command{ 26 | Use: "galaxyd", 27 | Short: "Basecoin Daemon (server)", 28 | PersistentPreRunE: server.PersistentPreRunEFn(ctx), 29 | } 30 | 31 | server.AddCommands(ctx, cdc, rootCmd, server.DefaultAppInit, 32 | server.ConstructAppCreator(newApp, "galaxy"), 33 | server.ConstructAppExporter(exportAppStateAndTMValidators, "galaxy")) 34 | 35 | // prepare and add flags 36 | rootDir := os.ExpandEnv("$HOME/.galaxyd") 37 | executor := cli.PrepareBaseCmd(rootCmd, "BC", rootDir) 38 | 39 | err := executor.Execute() 40 | if err != nil { 41 | // Note: Handle with #870 42 | panic(err) 43 | } 44 | } 45 | 46 | func newApp(logger log.Logger, db dbm.DB, storeTracer io.Writer) abci.Application { 47 | return app.NewGalaxyApp(logger, db, baseapp.SetPruning(viper.GetString("pruning"))) 48 | } 49 | 50 | func exportAppStateAndTMValidators(logger log.Logger, db dbm.DB, storeTracer io.Writer) (json.RawMessage, []tmtypes.GenesisValidator, error) { 51 | bapp := app.NewGalaxyApp(logger, db) 52 | return bapp.ExportAppStateAndValidators() 53 | } 54 | -------------------------------------------------------------------------------- /docs/getting-started.md: -------------------------------------------------------------------------------- 1 | # Getting started 2 | 3 | There are currently two supported operating system installations for Galaxy 4 | Core Software. 5 | 6 | 1. Installation 7 | #### Linux (Pi and x86 varieties) 8 | ``` 9 | bash <(curl -s https://raw.githubusercontent.com/galaxypi/galaxy/master/install.sh) 10 | ``` 11 | #### macOS 12 | ``` 13 | bash <(curl -s https://raw.githubusercontent.com/galaxypi/galaxy/master/install-mac.sh) 14 | ``` 15 | 16 | 2. Navigate to the Galaxy directory 17 | 18 | ``` 19 | cd ~/galaxy 20 | ``` 21 | 22 | 3. Run the Galaxy blockchain 23 | The installer should prompt you to type `./galaxyd start` when it is 24 | finished. This will start syncing the blockchain. 25 | 26 | 4. Create a Galaxy wallet 27 | Run the following in a second terminal window 28 | ``` 29 | ./galaxycli keys add 30 | ``` 31 | 32 |
33 |
34 | 35 | ``` 36 | Welcome to the Galaxy network ................................. 37 | ``` 38 | 39 |
40 | 41 | ### Receive Galaxy Coin 42 | 43 | - Join the [Galaxy Discord](https://discord.gg/36K9nan) chat app. 44 | - Ping one of the [repository maintainers](https://github.com/galaxypi/galaxy#repository-maintainers) and request to receive some Galaxy coin. 45 | 46 | ### Join the community 47 | - [Follow on Twitter](https://twitter.com/GalaxyPiLab) 48 | - [Contribute](/docs/CONTRIBUTING.md) 49 | - [Create a feature request](https://github.com/galaxypi/galaxy#feature-requests) 50 | 51 | 52 | ### Other instructions 53 | 54 | #### Manual installation 55 | 56 | Visit the [Manual installation](/docs/manual-install.md) page for manual instructions. 57 | 58 | #### Build instructions 59 | 60 | Learn more on how Galaxy build works. Visit the [Build instructions](/docs/build-instructions.md) 61 | -------------------------------------------------------------------------------- /docs/community.md: -------------------------------------------------------------------------------- 1 | # Community 2 | 3 | Get updates on Galaxy's development and chat with the project maintainers and community members. 4 | 5 | - Follow [@galaxypilab on Twitter](https://twitter.com/galaxypilab). 6 | - Join the official [Galaxy Discord](https://discord.gg/36K9nan) chat room. 7 | 8 | 9 | ## Table of contents 10 | 11 | - [Events](#events) 12 | - [Roadmap](#roadmap) 13 | - [Scrum](#scrum) 14 | 15 | 16 | ## Events 17 | 18 | The [Galaxy Events page](/docs/events.md) is a great resource for finding out where community members will be, Galaxy specific events, and more.. 19 | 20 | 21 | ## Roadmap 22 | 23 | View the detailed Galaxy Roadmap to see what's coming next. 24 | 25 | [› Galaxy Roadmap page](/docs/roadmap.md) 26 | 27 | Galaxy's mission is to become the world's largest network of decentralized 28 | nodes offering services for decentralized platforms. We are looking to do this 29 | by executing the following; 30 | 31 | - [ ] Focus on building and scaling the Galaxy blockchain and currency 32 | - [ ] Build a large community of open source developers 33 | - [ ] Provide high developers with access to this network of nodes by building 34 | and maintaining an SDK 35 | - [ ] Provide the best experience for developers to quickly deploy apps and 36 | services to decentralized platforms 37 | 38 | View the detailed [Galaxy Roadmap page](/docs/roadmap.md) to learn more about project overview, goals, execution to date, milestones, current tech stack, and more... 39 | 40 | ## Scrum 41 | 42 | [› Galaxy Weekly & Daily Scrum](/docs/scrum.md) 43 | 44 | The Galaxy community participates in [daily scrum](/docs/scrum.md#daily-scrum) standups and [weekly scrum](/docs/scrum.md#weekly-scrum) community calls. 45 | 46 | [› Past weekly community scrum calls](/docs/scrum.md#past-calls) 47 | 48 |
49 | ^ back to top 50 |
-------------------------------------------------------------------------------- /types/account.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | sdk "github.com/cosmos/cosmos-sdk/types" 5 | "github.com/cosmos/cosmos-sdk/wire" 6 | "github.com/cosmos/cosmos-sdk/x/auth" 7 | ) 8 | 9 | var _ auth.Account = (*AppAccount)(nil) 10 | 11 | // AppAccount is a custom extension for this application. It is an example of 12 | // extending auth.BaseAccount with custom fields. It is compatible with the 13 | // stock auth.AccountStore, since auth.AccountStore uses the flexible go-amino 14 | // library. 15 | type AppAccount struct { 16 | auth.BaseAccount 17 | 18 | Name string `json:"name"` 19 | } 20 | 21 | // nolint 22 | func (acc AppAccount) GetName() string { return acc.Name } 23 | func (acc *AppAccount) SetName(name string) { acc.Name = name } 24 | 25 | // NewAppAccount returns a reference to a new AppAccount given a name and an 26 | // auth.BaseAccount. 27 | func NewAppAccount(name string, baseAcct auth.BaseAccount) *AppAccount { 28 | return &AppAccount{BaseAccount: baseAcct, Name: name} 29 | } 30 | 31 | // GetAccountDecoder returns the AccountDecoder function for the custom 32 | // AppAccount. 33 | func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder { 34 | return func(accBytes []byte) (auth.Account, error) { 35 | if len(accBytes) == 0 { 36 | return nil, sdk.ErrTxDecode("accBytes are empty") 37 | } 38 | 39 | acct := new(AppAccount) 40 | err := cdc.UnmarshalBinaryBare(accBytes, &acct) 41 | if err != nil { 42 | panic(err) 43 | } 44 | 45 | return acct, err 46 | } 47 | } 48 | 49 | // GenesisState reflects the genesis state of the application. 50 | type GenesisState struct { 51 | Accounts []*GenesisAccount `json:"accounts"` 52 | } 53 | 54 | // GenesisAccount reflects a genesis account the application expects in it's 55 | // genesis state. 56 | type GenesisAccount struct { 57 | Name string `json:"name"` 58 | Address sdk.AccAddress `json:"address"` 59 | Coins sdk.Coins `json:"coins"` 60 | } 61 | 62 | // NewGenesisAccount returns a reference to a new GenesisAccount given an 63 | // AppAccount. 64 | func NewGenesisAccount(aa *AppAccount) *GenesisAccount { 65 | return &GenesisAccount{ 66 | Name: aa.Name, 67 | Address: aa.Address, 68 | Coins: aa.Coins.Sort(), 69 | } 70 | } 71 | 72 | // ToAppAccount converts a GenesisAccount to an AppAccount. 73 | func (ga *GenesisAccount) ToAppAccount() (acc *AppAccount, err error) { 74 | return &AppAccount{ 75 | Name: ga.Name, 76 | BaseAccount: auth.BaseAccount{ 77 | Address: ga.Address, 78 | Coins: ga.Coins.Sort(), 79 | }, 80 | }, nil 81 | } 82 | -------------------------------------------------------------------------------- /cmd/galaxycli/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/cosmos/cosmos-sdk/client" 7 | "github.com/cosmos/cosmos-sdk/client/keys" 8 | "github.com/cosmos/cosmos-sdk/client/lcd" 9 | "github.com/cosmos/cosmos-sdk/client/rpc" 10 | "github.com/cosmos/cosmos-sdk/client/tx" 11 | "github.com/galaxypi/galaxy/app" 12 | "github.com/galaxypi/galaxy/types" 13 | "github.com/cosmos/cosmos-sdk/version" 14 | authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" 15 | bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" 16 | ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/client/cli" 17 | stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli" 18 | "github.com/spf13/cobra" 19 | "github.com/tendermint/tendermint/libs/cli" 20 | ) 21 | 22 | // rootCmd is the entry point for this binary 23 | var ( 24 | rootCmd = &cobra.Command{ 25 | Use: "galaxycli", 26 | Short: "Basecoin light-client", 27 | } 28 | ) 29 | 30 | func main() { 31 | // disable sorting 32 | cobra.EnableCommandSorting = false 33 | 34 | // get the codec 35 | cdc := app.MakeCodec() 36 | 37 | // TODO: Setup keybase, viper object, etc. to be passed into 38 | // the below functions and eliminate global vars, like we do 39 | // with the cdc. 40 | 41 | // add standard rpc, and tx commands 42 | rpc.AddCommands(rootCmd) 43 | rootCmd.AddCommand(client.LineBreak) 44 | tx.AddCommands(rootCmd, cdc) 45 | rootCmd.AddCommand(client.LineBreak) 46 | 47 | // add query/post commands (custom to binary) 48 | rootCmd.AddCommand( 49 | client.GetCommands( 50 | stakecmd.GetCmdQueryValidator("stake", cdc), 51 | stakecmd.GetCmdQueryValidators("stake", cdc), 52 | stakecmd.GetCmdQueryDelegation("stake", cdc), 53 | stakecmd.GetCmdQueryDelegations("stake", cdc), 54 | authcmd.GetAccountCmd("acc", cdc, types.GetAccountDecoder(cdc)), 55 | )...) 56 | 57 | rootCmd.AddCommand( 58 | client.PostCommands( 59 | bankcmd.SendTxCmd(cdc), 60 | ibccmd.IBCTransferCmd(cdc), 61 | ibccmd.IBCRelayCmd(cdc), 62 | stakecmd.GetCmdCreateValidator(cdc), 63 | stakecmd.GetCmdEditValidator(cdc), 64 | stakecmd.GetCmdDelegate(cdc), 65 | stakecmd.GetCmdUnbond("stake", cdc), 66 | )...) 67 | 68 | // add proxy, version and key info 69 | rootCmd.AddCommand( 70 | client.LineBreak, 71 | lcd.ServeCommand(cdc), 72 | keys.Commands(), 73 | client.LineBreak, 74 | version.VersionCmd, 75 | ) 76 | 77 | // prepare and add flags 78 | executor := cli.PrepareMainCmd(rootCmd, "BC", os.ExpandEnv("$HOME/.galaxycli")) 79 | err := executor.Execute() 80 | if err != nil { 81 | // Note: Handle with #870 82 | panic(err) 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/app_test.go: -------------------------------------------------------------------------------- 1 | package app 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/galaxypi/galaxy/types" 8 | sdk "github.com/cosmos/cosmos-sdk/types" 9 | "github.com/cosmos/cosmos-sdk/wire" 10 | "github.com/cosmos/cosmos-sdk/x/auth" 11 | "github.com/stretchr/testify/require" 12 | abci "github.com/tendermint/tendermint/abci/types" 13 | "github.com/tendermint/tendermint/crypto" 14 | dbm "github.com/tendermint/tendermint/libs/db" 15 | "github.com/tendermint/tendermint/libs/log" 16 | ) 17 | 18 | func setGenesis(baseApp *GalaxyApp, accounts ...*types.AppAccount) (types.GenesisState, error) { 19 | genAccts := make([]*types.GenesisAccount, len(accounts)) 20 | for i, appAct := range accounts { 21 | genAccts[i] = types.NewGenesisAccount(appAct) 22 | } 23 | 24 | genesisState := types.GenesisState{Accounts: genAccts} 25 | stateBytes, err := wire.MarshalJSONIndent(baseApp.cdc, genesisState) 26 | if err != nil { 27 | return types.GenesisState{}, err 28 | } 29 | 30 | // initialize and commit the chain 31 | baseApp.InitChain(abci.RequestInitChain{ 32 | Validators: []abci.Validator{}, AppStateBytes: stateBytes, 33 | }) 34 | baseApp.Commit() 35 | 36 | return genesisState, nil 37 | } 38 | 39 | func TestGenesis(t *testing.T) { 40 | logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)).With("module", "sdk/app") 41 | db := dbm.NewMemDB() 42 | baseApp := NewGalaxyApp(logger, db) 43 | 44 | // construct a pubkey and an address for the test account 45 | pubkey := crypto.GenPrivKeyEd25519().PubKey() 46 | addr := sdk.AccAddress(pubkey.Address()) 47 | 48 | // construct some test coins 49 | coins, err := sdk.ParseCoins("77foocoin,99barcoin") 50 | require.Nil(t, err) 51 | 52 | // create an auth.BaseAccount for the given test account and set it's coins 53 | baseAcct := auth.NewBaseAccountWithAddress(addr) 54 | err = baseAcct.SetCoins(coins) 55 | require.Nil(t, err) 56 | 57 | // create a new test AppAccount with the given auth.BaseAccount 58 | appAcct := types.NewAppAccount("foobar", baseAcct) 59 | genState, err := setGenesis(baseApp, appAcct) 60 | require.Nil(t, err) 61 | 62 | // create a context for the BaseApp 63 | ctx := baseApp.BaseApp.NewContext(true, abci.Header{}) 64 | res := baseApp.accountMapper.GetAccount(ctx, baseAcct.Address) 65 | require.Equal(t, appAcct, res) 66 | 67 | // reload app and ensure the account is still there 68 | baseApp = NewGalaxyApp(logger, db) 69 | 70 | stateBytes, err := wire.MarshalJSONIndent(baseApp.cdc, genState) 71 | require.Nil(t, err) 72 | 73 | // initialize the chain with the expected genesis state 74 | baseApp.InitChain(abci.RequestInitChain{ 75 | Validators: []abci.Validator{}, AppStateBytes: stateBytes, 76 | }) 77 | 78 | ctx = baseApp.BaseApp.NewContext(true, abci.Header{}) 79 | res = baseApp.accountMapper.GetAccount(ctx, baseAcct.Address) 80 | require.Equal(t, appAcct, res) 81 | } 82 | -------------------------------------------------------------------------------- /install-mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Galaxy ACII graphic with newline for better UI 5 | echo -e " 6 | + 7 | + 8 | + + 9 | + 10 | + + 11 | + 12 | + + + 13 | + + 14 | Galaxy + 15 | + + 16 | + 17 | + + + 18 | + 19 | + 20 | " 21 | 22 | # Ask for consent with line breaks for better readability 23 | echo -e "This script will remove previously installed directories: 24 | - galaxycli 25 | - galaxyd" 26 | 27 | read -p "Are you ok with that? (y/N): " choice 28 | 29 | case "$choice" in 30 | y|Y) echo -e "Continuing with install... This could take a moment.\n";; 31 | *) echo "Aborting."; exit 1;; 32 | esac 33 | 34 | # REMOVES EXISTING INSTALL 35 | rm -rf ~/galaxy 36 | rm -rf ~/.galaxyd 37 | rm -rf ~/.galaxycli 38 | 39 | # puts the daemon and CLI into ~/galaxy 40 | echo "Downloading and installing.... galaxycli and galaxyd." 41 | mkdir ~/galaxy 42 | cd ~/galaxy 43 | curl -LO#f https://github.com/galaxypi/galaxy/releases/download/fourth/galaxyd_Darwin_x86_64 44 | curl -LO#f https://github.com/galaxypi/galaxy/releases/download/fourth/galaxycli_Darwin_x86_64 45 | mv galaxyd_Darwin_x86_64 galaxyd 46 | mv galaxycli_Darwin_x86_64 galaxycli 47 | chmod +x galaxycli 48 | chmod +x galaxyd 49 | 50 | echo -e "\nInitializing galaxyd...." 51 | 52 | # initalizes the blockchain 53 | ./galaxyd init &>/dev/null 54 | 55 | echo -e "\nFetching genesis block...." 56 | # fetches genesis.json 57 | curl -LO#f https://github.com/galaxypi/galaxy/raw/master/genesis.json 58 | mv genesis.json ~/.galaxyd/config/genesis.json 59 | 60 | echo -e "\n 61 | Adding seeds to config...." 62 | # find-and-replace on config.toml to set seed node 63 | original_string='seeds = ""' 64 | replace_string='seeds = "a0cd321854769978eea1ffb57d341ecaf6551905@149.28.45.92:26656,ea7ff5667f65c52e8c673bc96885a66fe6c1ec7b@98.118.185.162:26656,642f7a68f1af520a1b05134382fe97ba7513ee41@45.77.36.79:26656"' 65 | sed -i -e "s/$original_string/$replace_string/g" ~/.galaxyd/config/config.toml 66 | 67 | # get moniker 68 | echo -e "\nGalaxy needs to distinguish individual nodes from one another. This is \naccomplished by having users choose a Galaxy node name. \n\nRecommended name: 'galaxy-node'\n" 69 | read -p "Name your galaxy node: " name 70 | moniker_original="moniker = \"\"" 71 | moniker_actual="moniker = \"$name\"" 72 | sed -i -e "s/$moniker_original/$moniker_actual/g" "$HOME/.galaxyd/config/config.toml" 73 | 74 | # summary 75 | echo -e "\033[1;35m\n\nWelcome to the Galaxy network \xF0\x9F\x8E\x89 \xF0\x9F\x8C\x8C ..................... \033[0m\n 76 | Galaxy blockchain is now installed and ready to sync...... 77 | 78 | ............................................................................... 79 | 80 | Navigate into the galaxy directory by typing the following; 81 | cd ~/galaxy 82 | 83 | ..............................................................................." 84 | 85 | echo -e "\nThen open a new terminal window and sync your Galaxy Node by typing.... 86 | ~/galaxy 87 | ./galaxyd start 88 | 89 | Note: Syncing your Galaxy Node can take a while." -------------------------------------------------------------------------------- /docs/roadmap.md: -------------------------------------------------------------------------------- 1 | # Galaxy Project Roadmap 2 | 3 | The following is the Galaxy Project Roadmap defining the project, technology, goals, and future milestones. 4 | 5 | ## Table of contents 6 | 7 | - [Project Overview](#project-overview) 8 | - [Goals](#goals) 9 | - [Execution to date](#execution-to-date-3-sprints) 10 | - [Milestones](#milestones-unordered-list) 11 | - [Current Tech Stack](#current-tech-stack) 12 | - [Discovery](#discovery) 13 | - [Possible Future Technology](#possible-future-technology) 14 | 15 | ## Project Overview 16 | 17 | Galaxy's mission is to become the world's largest blockchain agnostic, always on, node network and protocol offering services to decentralized platforms. 18 | 19 | ## Goals 20 | 21 | - [ ] Become the world's largest blockchain agnostic, always on, node network and protocol offering services to decentralized platforms. 22 | - [ ] Build a large community of open source developers contributing and building node modules and applications on the Galaxy node network. 23 | - [ ] Work with the Galaxy developer community to provide developer tools offering the highest value. 24 | - [ ] Provide the best experience for developers to quickly deploy node modules, apps and services to decentralized platforms. 25 | 26 | ## Execution to date (3 sprints) 27 | 28 | #### Galaxy Core (Blockchain) 29 | - [x] Galaxy Testnet v0.1.0-alpha. 30 | - [x] Galaxy Testnet v0.2.0-alpha. 31 | - [x] Galaxy Testnet v0.3.0-alpha. 32 | - [x] One-line Install script (Linux). 33 | - [x] Galaxy Testnet v0.4.0-alpha (Custom Galaxy daemon & CLI). 34 | 35 | #### Galaxy Marketplace (Web App) 36 | - [x] Galaxy React Web App v0.1.0-alpha. 37 | 38 | ## Milestones (unordered list) 39 | 40 | - [ ] **Galaxy Core**: Galaxy Testnet v0.5.0-alpha (improving the design of the network for performance at the edges of the network). 41 | - [ ] **Galaxy Core**: Pi Image Builder. 42 | - [ ] **Growth**: Increasing the number of validators and full nodes 43 | - [ ] **Galaxy Token**: Launch the currency. 44 | - [ ] **Galaxy Core** & **Galaxy.ooo**: VPN across nodes for egress 45 | - [ ] **Galaxy Core**: Airdrops to node-operators. 46 | - [ ] **Galaxy Community**: Global Galaxy hackathons bootstrapped on the Raspberry Pi network. 47 | - [ ] **Galaxy Marketplace**: A web interface where developers can quickly deploy node modules, apps and services to decentralized networks. 48 | 49 | ## Current Tech Stack 50 | 51 | [› Galaxy Status](https://github.com/galaxypi/galaxy#status) for the lastest status of the Galaxy Tech Stack and dependencies. 52 | 53 | * Cosmos-SDK 54 | * Raspian Linux 55 | * Raspberry Pi Hardware 56 | 57 | ## Discovery 58 | Galaxy aims to make meaningful participation in a distributed ledger possible from even the smallest computers. Here are a few of the problems that come up when targeting small computers that live at the edge of the network: 59 | 60 | * Cross-compilation / comptability 61 | * Daemon resource usage 62 | * Network connectivity 63 | * Limited Storage Capacity 64 | * Consensus Latency 65 | 66 | The only advantage that we truly have in this case is that there can be many, cheap, small computers. We will devise a decentralized system that can use these machines as a cohesive whole. This will involve limiting the state storage needed on any given device, as well as new ways of thinking about the network. 67 | 68 | ## Possible Future Technology 69 | A conservative design involves a "core" where transactions happen. Eg: "100-300 validators" or "21 block producers" or "21 witnesses". We're looking to create a leaderless system that anyone can participate in using almost any computer. The Raspberry Pi Zero W just happens to suit our needs well because it is a very small computer (1 core, 512MB RAM, ~16GB Storage.) Users with at least a Raspberry Pi Zero W, regardless of instruction set architecture, should be able to run a Galaxy node and profit from it in some way. 70 | 71 | Nodes that carry state should be compenstated for doing so, since it is a service to the network. Nodes that don't carry any state should be able to perform compute tasks for users of the network, which should be orchestrated by "compute markets." Each node should carry its own wallet, making airdrops of tokens by developers of platform-native dapps to node operators possible. We don't claim to have a panacea to the engineering problems that we would like to address. Instead, we think that these problems are addressable incrementally, and through focused research: 72 | 73 | * How do we make a huge number of nodes work well together? 74 | * How do we provide a network layer that allows nodes to work together like they are in the same room? 75 | * How do we allow develoeprs to build distributed systems of their own on top of ours with no dependency on ours? (eg: freestanding systems, so that Galaxy is not a threat to the developers' systems) 76 | 77 | 78 | ## Use Cases 79 | 80 | #### Examples of what the network can be used for 81 | 82 | - [ ] Use nodes for airdrops to reach high signal developers actively participating in the network instead of speculators. 83 | - [ ] Pay users for compute, storage, bandwidth, staking, etc. 84 | - [ ] Repurpose existing Raspberry Pi projects to grow those communities and reward participation. 85 | 86 | 87 |
88 | ^ back to top 89 |
90 | -------------------------------------------------------------------------------- /app/app.go: -------------------------------------------------------------------------------- 1 | package app 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | bam "github.com/cosmos/cosmos-sdk/baseapp" 7 | "github.com/galaxypi/galaxy/types" 8 | sdk "github.com/cosmos/cosmos-sdk/types" 9 | "github.com/cosmos/cosmos-sdk/wire" 10 | "github.com/cosmos/cosmos-sdk/x/auth" 11 | "github.com/cosmos/cosmos-sdk/x/bank" 12 | "github.com/cosmos/cosmos-sdk/x/ibc" 13 | abci "github.com/tendermint/tendermint/abci/types" 14 | cmn "github.com/tendermint/tendermint/libs/common" 15 | dbm "github.com/tendermint/tendermint/libs/db" 16 | "github.com/tendermint/tendermint/libs/log" 17 | tmtypes "github.com/tendermint/tendermint/types" 18 | ) 19 | 20 | const ( 21 | appName = "GalaxyApp" 22 | ) 23 | 24 | // GalaxyApp implements an extended ABCI application. It contains a BaseApp, 25 | // a codec for serialization, KVStore keys for multistore state management, and 26 | // various mappers and keepers to manage getting, setting, and serializing the 27 | // integral app types. 28 | type GalaxyApp struct { 29 | *bam.BaseApp 30 | cdc *wire.Codec 31 | 32 | // keys to access the multistore 33 | keyMain *sdk.KVStoreKey 34 | keyAccount *sdk.KVStoreKey 35 | keyIBC *sdk.KVStoreKey 36 | 37 | // manage getting and setting accounts 38 | accountMapper auth.AccountMapper 39 | feeCollectionKeeper auth.FeeCollectionKeeper 40 | coinKeeper bank.Keeper 41 | ibcMapper ibc.Mapper 42 | } 43 | 44 | // NewGalaxyApp returns a reference to a new GalaxyApp given a logger and 45 | // database. Internally, a codec is created along with all the necessary keys. 46 | // In addition, all necessary mappers and keepers are created, routes 47 | // registered, and finally the stores being mounted along with any necessary 48 | // chain initialization. 49 | func NewGalaxyApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.BaseApp)) *GalaxyApp { 50 | // create and register app-level codec for TXs and accounts 51 | cdc := MakeCodec() 52 | 53 | // create your application type 54 | var app = &GalaxyApp{ 55 | cdc: cdc, 56 | BaseApp: bam.NewBaseApp(appName, cdc, logger, db, baseAppOptions...), 57 | keyMain: sdk.NewKVStoreKey("main"), 58 | keyAccount: sdk.NewKVStoreKey("acc"), 59 | keyIBC: sdk.NewKVStoreKey("ibc"), 60 | } 61 | 62 | // define and attach the mappers and keepers 63 | app.accountMapper = auth.NewAccountMapper( 64 | cdc, 65 | app.keyAccount, // target store 66 | auth.ProtoBaseAccount, // prototype 67 | ) 68 | app.coinKeeper = bank.NewKeeper(app.accountMapper) 69 | app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace)) 70 | 71 | // register message routes 72 | app.Router(). 73 | AddRoute("bank", bank.NewHandler(app.coinKeeper)). 74 | AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)) 75 | 76 | // perform initialization logic 77 | app.SetInitChainer(app.initChainer) 78 | app.SetBeginBlocker(app.BeginBlocker) 79 | app.SetEndBlocker(app.EndBlocker) 80 | app.SetAnteHandler(auth.NewAnteHandler(app.accountMapper, app.feeCollectionKeeper)) 81 | 82 | // mount the multistore and load the latest state 83 | app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyIBC) 84 | err := app.LoadLatestVersion(app.keyMain) 85 | if err != nil { 86 | cmn.Exit(err.Error()) 87 | } 88 | 89 | return app 90 | } 91 | 92 | // MakeCodec creates a new wire codec and registers all the necessary types 93 | // with the codec. 94 | func MakeCodec() *wire.Codec { 95 | cdc := wire.NewCodec() 96 | 97 | wire.RegisterCrypto(cdc) 98 | sdk.RegisterWire(cdc) 99 | bank.RegisterWire(cdc) 100 | ibc.RegisterWire(cdc) 101 | 102 | // register custom types 103 | cdc.RegisterInterface((*auth.Account)(nil), nil) 104 | cdc.RegisterConcrete(&types.AppAccount{}, "galaxy/Account", nil) 105 | 106 | cdc.Seal() 107 | 108 | return cdc 109 | } 110 | 111 | // BeginBlocker reflects logic to run before any TXs application are processed 112 | // by the application. 113 | func (app *GalaxyApp) BeginBlocker(_ sdk.Context, _ abci.RequestBeginBlock) abci.ResponseBeginBlock { 114 | return abci.ResponseBeginBlock{} 115 | } 116 | 117 | // EndBlocker reflects logic to run after all TXs are processed by the 118 | // application. 119 | func (app *GalaxyApp) EndBlocker(_ sdk.Context, _ abci.RequestEndBlock) abci.ResponseEndBlock { 120 | return abci.ResponseEndBlock{} 121 | } 122 | 123 | // initChainer implements the custom application logic that the BaseApp will 124 | // invoke upon initialization. In this case, it will take the application's 125 | // state provided by 'req' and attempt to deserialize said state. The state 126 | // should contain all the genesis accounts. These accounts will be added to the 127 | // application's account mapper. 128 | func (app *GalaxyApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { 129 | stateJSON := req.AppStateBytes 130 | 131 | genesisState := new(types.GenesisState) 132 | err := app.cdc.UnmarshalJSON(stateJSON, genesisState) 133 | if err != nil { 134 | // TODO: https://github.com/cosmos/cosmos-sdk/issues/468 135 | panic(err) 136 | } 137 | 138 | for _, gacc := range genesisState.Accounts { 139 | acc, err := gacc.ToAppAccount() 140 | if err != nil { 141 | // TODO: https://github.com/cosmos/cosmos-sdk/issues/468 142 | panic(err) 143 | } 144 | 145 | acc.AccountNumber = app.accountMapper.GetNextAccountNumber(ctx) 146 | app.accountMapper.SetAccount(ctx, acc) 147 | } 148 | 149 | return abci.ResponseInitChain{} 150 | } 151 | 152 | // ExportAppStateAndValidators implements custom application logic that exposes 153 | // various parts of the application's state and set of validators. An error is 154 | // returned if any step getting the state or set of validators fails. 155 | func (app *GalaxyApp) ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { 156 | ctx := app.NewContext(true, abci.Header{}) 157 | accounts := []*types.GenesisAccount{} 158 | 159 | appendAccountsFn := func(acc auth.Account) bool { 160 | account := &types.GenesisAccount{ 161 | Address: acc.GetAddress(), 162 | Coins: acc.GetCoins(), 163 | } 164 | 165 | accounts = append(accounts, account) 166 | return false 167 | } 168 | 169 | app.accountMapper.IterateAccounts(ctx, appendAccountsFn) 170 | 171 | genState := types.GenesisState{Accounts: accounts} 172 | appState, err = wire.MarshalJSONIndent(app.cdc, genState) 173 | if err != nil { 174 | return nil, nil, err 175 | } 176 | 177 | return appState, validators, err 178 | } 179 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Galaxy ACII graphic with newline for better UI 5 | echo -e " 6 | + 7 | + 8 | + + 9 | + 10 | + + 11 | + 12 | + + + 13 | + + 14 | Galaxy + 15 | + + 16 | + 17 | + + + 18 | + 19 | + 20 | " 21 | 22 | DEPENDENCIES="curl" 23 | 24 | ARCH="$(uname -s)_$(uname -m)" 25 | INSTALL_DIR="$HOME/galaxy" 26 | SEEDS=$(curl -s https://raw.githubusercontent.com/galaxypi/galaxy/develop/seeds) 27 | 28 | 29 | function getMatchingAssets { 30 | # the following sed/grep block of magic transforms the api response from GitHub into a list of 31 | # the assets of the latest release, the list consists of the asset name and then its url, 32 | # all separated by newlines; this got make `jq` obsolete as dependency 33 | assets=$(curl -s https://api.github.com/repos/galaxypi/galaxy/releases/latest | \ 34 | sed -n '/"assets": \[/,/\]/p' | \ 35 | sed -n '/"\(name\|browser_download_url\)": "/p' | \ 36 | sed 's/\s*"name": "//g' | \ 37 | sed 's/^\s*"browser_download_url": "//g' | \ 38 | sed 's/",$//g' | \ 39 | sed 's/"$//g') 40 | # meta: the following comments document the commands from above line by line (because of the `\` it's not possible to document them above) 41 | # downloads JSON for the last release 42 | # greps the relevant asset block 43 | # greps all relevant lines (asset names and asset urls) 44 | # removes the `"name": "` at the beginning of a line 45 | # removes the `"browser_download_url": "` at the beginning of a line 46 | # removes the `",` at the end of a line 47 | # removes the `"` at the end of a line 48 | 49 | 50 | urls="" 51 | index=0 52 | take_next=false 53 | 54 | # go through the list 55 | while read -r line; do 56 | if [ $(( $index % 2 )) -eq 0 ]; then 57 | # `line` is a asset name 58 | 59 | # set `take_next` to true to add it to `urls` in the next iteration 60 | if [ "$line" == "galaxycli_$ARCH" ] || [ "$line" == "galaxyd_$ARCH" ]; then 61 | take_next=true 62 | fi 63 | else 64 | # `line` is a asset url 65 | 66 | # add the asset url to `urls` and reset `take_next` 67 | if [ "$take_next" = true ]; then 68 | urls+="$line " 69 | fi 70 | take_next=false 71 | fi 72 | 73 | let index=index+1 74 | done <<< $assets 75 | 76 | echo "$urls" 77 | } 78 | 79 | 80 | function downloadAssets { 81 | urls="$@" 82 | echo -e "\e[92m " 83 | for url in $urls; do 84 | curl -LO#f "$url" 85 | done 86 | echo -e "\e[0m " 87 | } 88 | 89 | # download and parse latest release information from GitHub 90 | urls="$(getMatchingAssets)" 91 | 92 | # fail if there wasn't a matching architecture in the release assets 93 | if [ -z "$urls" ]; then 94 | echo "Could not find a matching release of galaxycli and galaxyd for your architecture ($ARCH)." 95 | echo "If you know what you're doing and think it should work on your architecture, you can set your architecture manually at the beginning of this script and then run it again." 96 | exit 1 97 | fi 98 | 99 | 100 | # check for needed dependencies 101 | for dependency in $DEPENDENCIES; do 102 | if ! command -v "$dependency" &>/dev/null; then 103 | echo "It seems that \"$dependency\" isn't installed but I really need it :/" 104 | echo "Please install it and re-run this script." 105 | exit 1 106 | fi 107 | done 108 | 109 | 110 | # ask for consent 111 | # Ask for consent with line breaks for better readability 112 | echo -e "This script will remove previously installed directories: 113 | - galaxycli 114 | - galaxyd" 115 | 116 | read -p "Are you ok with that? (y/N): " choice 117 | case "$choice" in 118 | y|Y) echo -e "Continuing with install... This could take a moment.\n";; 119 | *) echo "Aborting."; exit 1;; 120 | esac 121 | 122 | 123 | # create install dir (if necessary) and change into it 124 | [[ ! -d "$INSTALL_DIR" ]] && mkdir "$INSTALL_DIR" 125 | cd "$INSTALL_DIR" 126 | 127 | 128 | # clear old files 129 | echo "Removing previously installed galaxycli and galaxyd." 130 | [[ -f "./galaxycli" ]] && rm "./galaxycli" 131 | [[ -f "./galaxyd" ]] && rm "./galaxyd" 132 | [[ -d "$HOME/.galaxycli" ]] && rm -r "$HOME/.galaxycli" 133 | [[ -d "$HOME/.galaxyd" ]] && rm -r "$HOME/.galaxyd" 134 | 135 | 136 | # download the (previously) matched release assets 137 | echo -e "\nDownloading and installing..... galaxycli and galaxyd." 138 | downloadAssets $urls 139 | 140 | # move the binaries to not include the arch and make them executable 141 | mv "galaxycli_$ARCH" "galaxycli" 142 | mv "galaxyd_$ARCH" "galaxyd" 143 | chmod +x "galaxycli" 144 | chmod +x "galaxyd" 145 | 146 | 147 | # intialize galaxyd 148 | echo -e "\nInitializing galaxyd...." 149 | ./galaxyd init &>/dev/null 150 | 151 | 152 | # add seeds 153 | echo -e "\nAdding seeds to config...." 154 | original_string="seeds = \"\"" 155 | replace_string="seeds = \"$SEEDS\"" 156 | sed -i -e "s/$original_string/$replace_string/g" "$HOME/.galaxyd/config/config.toml" 157 | 158 | # get moniker 159 | echo -e "\nGalaxy needs to distinguish individual nodes from one another. This is \naccomplished by having users choose a Galaxy node name. \n\nRecommended name: 'galaxy-node'\n" 160 | read -p "Name your galaxy node: " name 161 | moniker_original="moniker = \"\"" 162 | moniker_actual="moniker = \"$name\"" 163 | sed -i -e "s/$moniker_original/$moniker_actual/g" "$HOME/.galaxyd/config/config.toml" 164 | 165 | # fetch the genesis block 166 | echo -e "\nFetching genesis block...." 167 | curl -Os "https://raw.githubusercontent.com/galaxypi/galaxy/master/genesis.json" 168 | mv "genesis.json" "$HOME/.galaxyd/config/genesis.json" 169 | 170 | 171 | # summary 172 | echo -e "\033[1;35m\n\nWelcome to the Galaxy network \xF0\x9F\x8E\x89 \xF0\x9F\x8C\x8C ..................... \033[0m\n 173 | Galaxy blockchain is now installed and ready to sync...... 174 | 175 | ............................................................................... 176 | 177 | Navigate into the galaxy directory by typing the following; 178 | cd ~/galaxy 179 | 180 | ..............................................................................." 181 | 182 | echo -e "\nThen open a new terminal window and sync your Galaxy Node by typing.... 183 | \"$INSTALL_DIR\" 184 | ./galaxyd start 185 | 186 | Note: Syncing your Galaxy Node can take a while." 187 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | - [Using the issue tracker](#using-the-issue-tracker) 4 | - [Bug report](#bug-report) 5 | - [Feature requests](#feature-requests) 6 | - [Pull requests](#pull-requests) 7 | - [Code guidelines](#code-guidelines) 8 | - [Versioning](#versioning) 9 | 10 | Looking to contribute something to Galaxy? Here's how you can help. 11 | 12 | Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. 13 | 14 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. 15 | 16 | ## Using the issue tracker 17 | 18 | The [issue tracker](https://github.com/galaxypi/galaxy/issues) is the preferred channel for [bug reports](#bug-report), [features requests](#feature-requests), [custom issues](https://github.com/galaxypi/galaxy/issues/new?template=custom-issue.md) and [submitting pull requests](#pull-requests), but please respect the following restrictions: 19 | 20 | * Please **do not** use the issue tracker for personal support requests. Please use the [Galaxy Discord](https://discord.gg/36K9nan) chat app as it is a better places to get help. 21 | 22 | * Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others. 23 | 24 | * Please **do not** post comments consisting solely of "+1" or ":thumbsup:". Use [GitHub's "reactions" feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) instead. We reserve the right to delete comments which violate this rule. 25 | 26 | ### When reporting a bug, include: 27 | 28 | * Device and device version (Raspberry Pi Zero, Raspberry Pi 2, MacBook Pro etc..) 29 | 30 | * Operating system and version (Mac OS X, Linux, Raspian, etc..) 31 | 32 | 33 | ## Bug report 34 | 35 | A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful, so thanks! 36 | 37 | › Report bug 38 | 39 | Guidelines for bug reports: 40 | 41 | 1. **Debug yuor code** — [Debug your Go code with GDB](https://golang.org/doc/gdb) to ensure your problem isn't caused by a simple error in your own code. 42 | 43 | 2. **Use the GitHub issue search** — [Search for duplicate or closed issues](https://github.com/galaxypi/galaxy/issues?q=is%3Aopen). See GitHub's [Advanced Search Syntax](https://help.github.com/articles/searching-issues-and-pull-requests/). 44 | 45 | 3. **Check if the issue has been fixed** — try to reproduce it using the latest `master`, `develop` or development branch in the repository. 46 | 47 | A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What device and OS are you using when experiencing the problem? Do other environments show the bug differently? What would you expect to be the outcome? All these details will help people to fix any potential bugs. 48 | 49 | Example: 50 | 51 | > Short and descriptive example bug report title 52 | > 53 | > A summary of the issue and the device/OS environment in which it occurs. If 54 | > suitable, include the steps required to reproduce the bug. 55 | > 56 | > 1. This is the first step 57 | > 2. This is the second step 58 | > 3. Further steps, etc. 59 | > 60 | > `` - a link to the reduced test case 61 | > 62 | > Any other information you want to share that is relevant to the issue being 63 | > reported. This might include the lines of code that you have identified as 64 | > causing the bug, and potential solutions (and your opinions on their 65 | > merits). 66 | 67 | ## Feature requests 68 | 69 | **Feature requests are highly encouraged. We want to hear from you on what you'd like to see and/or how you'd like to utilize or access the Galaxy node network**. 70 | 71 | › Request a feature 72 | 73 | When submitting a feature request, take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince community members of the merits of this feature. Please provide as much detail and context as possible, providing relevant links, prior art, or live demos whenever possible. 74 | 75 | 76 | ## Pull requests 77 | 78 | Good pull requests—patches, improvements, new features—are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. 79 | 80 | **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. 81 | 82 | Pull requests that add new features should target [the `develop` git branch](https://github.com/galaxypi/galaxy/tree/develop), where they will be welcomed and duly considered. 83 | 84 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). 85 | 86 | Adhering to the following process is the best way to get your work included in the project: 87 | 88 | 1. [Fork](https://help.github.com/fork-a-repo/) the project. 89 | 90 | i. On GitHub, navigate to the [GalaxyPi/Galaxy]( 91 | https://github.com/galaxypi/galaxy) repository. 92 |
93 | ii. In the top-right corner of the page, click **Fork**. 94 | 95 | 96 | 2. [Clone your fork]( 97 | https://help.github.com/articles/fork-a-repo/#keep-your-fork-synced), and 98 | configure the remotes: 99 | 100 | ``` 101 | # Clone your fork of the repo into the current directory 102 | git clone https://github.com//galaxy.git 103 | # Navigate to the newly cloned directory 104 | cd galaxy 105 | # Assign the original repo to a remote called "upstream" 106 | git remote add upstream https://github.com/galaxypi/galaxy.git 107 | ``` 108 | 109 | 3. If you cloned a while ago, get the latest changes from upstream: 110 | 111 | ``` 112 | git checkout develop 113 | git pull upstream develop 114 | ``` 115 | 116 | 4. Create a new topic branch (off the main project development branch) to 117 | contain your feature, change, or fix: 118 | 119 | ``` 120 | git checkout -b pull-request/ 121 | ``` 122 | 123 | 5. Commit your changes in logical chunks. Please adhere to these 124 | [git commit message guidelines]( 125 | http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 126 | or your code is unlikely to be merged into the main project. Use Git's 127 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 128 | feature to tidy up your commits before making them public. 129 | 130 | 6. Locally merge (or rebase) the upstream development branch into your topic 131 | branch: 132 | 133 | ``` 134 | git pull [--rebase] upstream develop 135 | ``` 136 | 137 | 7. Push your topic branch up to your fork: 138 | 139 | ``` 140 | git push origin pull-request/ 141 | ``` 142 | 143 | 8. [Open a Pull Request]( 144 | https://help.github.com/articles/using-pull-requests/) with a clear title 145 | and description against the `develop` branch. 146 | 147 | **IMPORTANT**: By submitting a patch, you agree to allow the project owners to 148 | license your work under the terms of the [MIT License](https://github.com/galaxypi/galaxy/blob/master/LICENSE.md) (if it 149 | includes code changes). 150 | 151 | 152 | ## Code guidelines 153 | 154 | Adhere to the [Effective Go]( 155 | https://golang.org/doc/effective_go.html) code guide. to write clear, idiomatic Go code. 156 | The code guide provides tips on items such as [Formatting]( 157 | https://golang.org/doc/effective_go.html#formatting), [Commentary]( 158 | https://golang.org/doc/effective_go.html#commentary), [Control Structures]( 159 | https://golang.org/doc/effective_go.html#control-structures), [Functions]( 160 | https://golang.org/doc/effective_go.html#functions), [Methods]( 161 | https://golang.org/doc/effective_go.html#methods) and much more. 162 | 163 | New to Go? Get started by visiting [How to Write Go Code](https://golang.org/doc/code.html). 164 | 165 | 166 | ## Versioning 167 | 168 | For transparency into our release cycle and in striving to maintain backward compatibility, Galaxy is maintained under [the Semantic Versioning guidelines](https://semver.org/). Sometimes we screw up, but we'll adhere to those rules whenever possible. 169 | 170 | See [the Releases section of our GitHub project](https://github.com/galaxypi/galaxy/releases) for changelogs for each release version of Galaxy. 171 | 172 |
173 | ^ back to top 174 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

Galaxy

6 |

7 | Galaxy is a blockchain agnostic node network and protocol offering services to decentralized platforms 8 |
9 | galaxy.ooo 10 |
11 |
12 | Request feature 13 |  ·  14 | Explore 15 |  ·  16 | 17 | Report bug 18 |  ·  19 | Chat 20 |
21 |
22 | 23 | follow on Twitter 24 | 25 |  ·  26 | 27 | Star Repo 28 | 29 |

30 |

31 |
32 |

33 | 34 |

35 | 36 |
37 | 38 | ## Table of contents 39 | 40 | - [Quick Start](#quick-start) 41 | - [Status](#status) 42 | - [Bug report](#bug-report) 43 | - [Feature requests](#feature-requests) 44 | - [Contributing](#contributing) 45 | - [Roadmap](#roadmap) 46 | - [Community](#community) 47 | - [Repository maintainers](#repository-maintainers) 48 | - [License](#license) 49 | 50 |
51 | ^ back to top 52 |
53 | 54 | 55 | ## Quick start 56 | 57 | Quick start options: 58 | 59 | There are currently two supported operating system installations for Galaxy 60 | Core Software. 61 | 62 | 1. Installation. 63 | #### Linux (Pi and x86 varieties) 64 | ``` 65 | bash <(curl -s https://raw.githubusercontent.com/galaxypi/galaxy/master/install.sh) 66 | ``` 67 | #### macOS 68 | ``` 69 | bash <(curl -s https://raw.githubusercontent.com/galaxypi/galaxy/master/install-mac.sh) 70 | ``` 71 | 72 | 2. Navigate to the Galaxy directory. 73 | 74 | ``` 75 | cd ~/galaxy 76 | ``` 77 | 78 | 3. Run the Galaxy blockchain 79 | The installer should prompt you to type `./galaxyd start` when it is 80 | finished. This will start syncing the blockchain. 81 | 82 | 4. Create a Galaxy wallet. 83 | Run the following in a second terminal window. 84 | ``` 85 | ./galaxycli keys add 86 | ``` 87 | 88 |
89 |
90 | 91 | ``` 92 | Welcome to the Galaxy network ................................. 93 | ``` 94 | 95 |
96 | 97 | Read the [Getting started](/docs/getting-started.md) page for more detailed information on installing and 98 | syncing Galaxy. 99 | 100 |
101 | ^ back to top 102 |
103 | 104 | 105 | ## Status 106 | 107 | - Ability to sync Blockchain on both Linux & macOS devices. 108 | - Ability to send Galaxy coin. 109 | 110 | [![Galaxy Version](https://img.shields.io/badge/Galaxy-Testnet_v0.4.0--alpha-red.svg?colorA=212121&colorB=FF0000)](https://github.com/galaxypi/galaxy/releases) 111 | [![Galaxy Chat](https://img.shields.io/badge/Galaxy_Chat-Discord-purple.svg?colorA=212121&colorB=7289da)](https://discord.gg/36K9nan) 112 | 113 | [![CircleCI](https://circleci.com/gh/galaxypi/galaxy.svg?style=svg&circle-token=45e7031f4720e17a24978c9ee53c6340657cfac3)](https://circleci.com/gh/galaxypi/galaxy) 114 | [![Go Version](https://img.shields.io/badge/Go-v1.10.3-blue.svg?colorA=212121&colorB=007BFF)](http://golang.org/) 115 | [![Viper Version](https://img.shields.io/badge/Viper-v1.0.0-blue.svg?colorA=212121&colorB=007BFF)](http://github.com/spf13/viper) 116 | [![Testify Version](https://img.shields.io/badge/Testify-v1.2.1-blue.svg?colorA=212121&colorB=007BFF)](http://github.com/stretchr/testify) 117 | [![Go Protocol Buffers Version](https://img.shields.io/badge/ProtoBuf-v1.1.0-blue.svg?colorA=212121&colorB=007BFF)](http://github.com/golang/protobuf) 118 | [![Tendermint Version](https://img.shields.io/badge/Tendermint-v0.22.0-red.svg?colorA=212121&colorB=FF0000)](http://github.com/tendermint/tendermint) 119 | [![Cosmos-SDK Version](https://img.shields.io/badge/Cosmos_SDK-v0.22.0-red.svg?colorA=212121&colorB=FF0000)](http://github.com/cosmos/cosmos-sdk) 120 | [![Cobra Version](https://img.shields.io/badge/Cobra-v0.0.1-red.svg?colorA=212121&colorB=FF0000)](http://github.com/spf13/cobra) 121 | 122 |
123 | ^ back to top 124 |
125 | 126 | 127 | ## Bug report 128 | 129 | Found a bug or issue? Please first read the [issue & bug guidelines](/docs/CONTRIBUTING.md#using-the-issue-tracker) 130 | and search for existing and closed issues. If your problem is not addressed yet, [please open a bug report](https://github.com/galaxypi/galaxy/issues/new?template=bug_report.md). 131 | 132 |
133 | ^ back to top 134 |
135 | 136 | 137 | ## Feature requests 138 | 139 | Feature requests are highly encouraged. We want to hear from you on what 140 | you'd like to see and/or how you'd like to utilize or access the Galaxy node 141 | network. 142 | 143 | › Request a feature 144 | 145 | When submitting a feature request, take a moment to find out whether your idea 146 | fits with the scope and aims of the project. It's up to *you* to make a strong 147 | case to convince community members of the merits of this feature. Please 148 | provide as much detail and context as possible, providing relevant links, prior 149 | art, or live demos whenever possible. 150 | 151 |
152 | ^ back to top 153 |
154 | 155 | 156 | ## Contributing 157 | 158 | Please read through our [contributing guidelines](/docs/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development. 159 | 160 | Moreover, if your pull request contains JavaScript patches or features, you 161 | must include relevant unit tests. All code should conform to the [Code Guidelines](/docs/CONTRIBUTING.md#code-guidelines). 162 | 163 |
164 | ^ back to top 165 |
166 | 167 | 168 | ## Roadmap 169 | 170 | View the detailed Galaxy Roadmap to see what's coming next. 171 | 172 | [› Galaxy Roadmap page](/docs/roadmap.md) 173 | 174 | Galaxy's mission is to become the world's largest blockchain agnostic, always on, node network and protocol offering services to decentralized platforms. 175 | 176 | We are looking to accomplish this by executing the following; 177 | 178 | - [ ] Building and maintaining the Galaxy blockchain and protocol. 179 | - [ ] Designing and building beautiful modified tiny computers (Raspberry Pi) 180 | as Galaxy nodes. 181 | - [ ] Providing an exceptional API, SDK and marketplace experience that allows 182 | developers to easily access and build on top of the Galaxy node network. 183 | - [ ] A simple and easy node owner interface and incentive program to 184 | incentivize node owners. 185 | - [ ] Provide the best experience for developers to quickly deploy node 186 | modules, apps and services to decentralized platforms. 187 | 188 | View the detailed [Galaxy Roadmap page](/docs/roadmap.md) to learn more about project overview, goals, execution to date, milestones, current tech stack, and more... 189 | 190 |
191 | ^ back to top 192 |
193 | 194 | 195 | ## Community 196 | 197 | Get updates on Galaxy's development and chat with the project maintainers and community members. 198 | 199 | - Follow [@galaxypilab on Twitter](https://twitter.com/galaxypilab). 200 | - Join the official [Galaxy Discord](https://discord.gg/36K9nan) chat room. 201 | 202 | [› Galaxy Community page](/docs/community.md) 203 | 204 | For more details on how to get involved in the Galaxy Community visit the [Galaxy Community page](/docs/community.md) and learn more about events, roadmap, weekly & daily scrum, past weekly community scrum calls, and more... 205 | 206 |
207 | ^ back to top 208 |
209 | 210 | 211 | ## Repository maintainers 212 | 213 | **Jacob Gadikian**, _Blockchain Engineer_ 214 | - 215 | - 216 | 217 | **Clint Nelsen**, _Operations & Marketing_ 218 | - 219 | - 220 | 221 | **Lukas Etter**, _Operations & Business Development_ 222 | - 223 | - 224 | 225 |
226 | ^ back to top 227 |
228 | 229 | 230 | ## License 231 | 232 | By contributing your code, you agree to license your contribution under the [ 233 | MIT License](LICENSE.md). 234 | 235 |
236 | 237 | Open Source 238 | 239 |
240 | --------------------------------------------------------------------------------