diff --git a/.dockerignore b/.dockerignore index b193b395..b178a73b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,8 @@ vendor/ Dockerfile -deployment/ *.sublime-project *.sublime-workspace .kvd/ .kvcli/ +scratch/ +testnets/ diff --git a/.gitignore b/.gitignore index f2fae544..bf38f2d2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,3 @@ # Exclude build files vendor - -# Exclude text editor files -*.sublime-project -*.sublime-workspace - -# Exclude kubernetes secrets -deployment/secret*.yml diff --git a/Dockerfile b/Dockerfile index b36cdfc9..967b85c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN go build ./cmd/kvd && go build ./cmd/kvcli # Copy app binary over to small container. # Using alpine instad of scratch to aid in debugging and avoid complicated compile +# note the home directory for alpine is /root/ FROM alpine COPY --from=builder /go/src/github.com/kava-labs/kava/kvd /go/src/github.com/kava-labs/kava/kvcli /usr/bin/ CMD ["kvd", "start"] diff --git a/Gopkg.lock b/Gopkg.lock index df460023..56ae6e15 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,99 +2,150 @@ [[projects]] + branch = "master" + digest = "1:09a7f74eb6bb3c0f14d8926610c87f569c5cff68e978d30e9a3540aeb626fdf0" + name = "github.com/bartekn/go-bip39" + packages = ["."] + pruneopts = "UT" + revision = "a05967ea095d81c8fe4833776774cfaff8e5036c" + +[[projects]] + branch = "master" + digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" + name = "github.com/beorn7/perks" + packages = ["quantile"] + pruneopts = "UT" + revision = "3a771d992973f24aa725d07868b467d1ddfceafb" + +[[projects]] + digest = "1:1343a2963481a305ca4d051e84bc2abd16b601ee22ed324f8d605de1adb291b0" name = "github.com/bgentry/speakeasy" packages = ["."] + pruneopts = "UT" revision = "4aabc24848ce5fd31929f7d1e4ea74d3709c14cd" version = "v0.1.0" [[projects]] branch = "master" - name = "github.com/btcsuite/btcd" - packages = ["btcec"] - revision = "86fed781132ac890ee03e906e4ecd5d6fa180c64" + digest = "1:70f6b224a59b2fa453debffa85c77f71063d8754b90c8c4fbad5794e2c382b0f" + name = "github.com/brejski/hid" + packages = ["."] + pruneopts = "UT" + revision = "06112dcfcc50a7e0e4fd06e17f9791e788fdaafc" [[projects]] branch = "master" + digest = "1:2c00f064ba355903866cbfbf3f7f4c0fe64af6638cc7d1b8bdcf3181bc67f1d8" + name = "github.com/btcsuite/btcd" + packages = ["btcec"] + pruneopts = "UT" + revision = "f899737d7f2764dc13e4d01ff00108ec58f766a9" + +[[projects]] + digest = "1:386de157f7d19259a7f9c81f26ce011223ce0f090353c1152ffdf730d7d10ac2" name = "github.com/btcsuite/btcutil" packages = ["bech32"] + pruneopts = "UT" revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4" [[projects]] + digest = "1:bb617355120eed649354b41a20d1745b2feb994e4da1a97591259143ad65375a" name = "github.com/cosmos/cosmos-sdk" packages = [ "baseapp", "client", "client/context", "client/keys", - "client/lcd", "client/rpc", "client/tx", - "cmd/gaia/app", + "crypto", + "crypto/keys", + "crypto/keys/bcrypt", + "crypto/keys/bip39", + "crypto/keys/hd", "server", + "server/config", "store", - "tests", "types", "version", "wire", "x/auth", "x/auth/client/cli", - "x/auth/client/rest", "x/bank", "x/bank/client", "x/bank/client/cli", - "x/bank/client/rest", + "x/gov", "x/ibc", - "x/ibc/client/cli", - "x/ibc/client/rest", + "x/mock", "x/slashing", + "x/slashing/client/cli", "x/stake", "x/stake/client/cli", - "x/stake/client/rest" + "x/stake/keeper", + "x/stake/tags", + "x/stake/types", ] - revision = "c6711810a86f09457481a8dadae899681a9d77ab" - version = "v0.19.0" + pruneopts = "UT" + revision = "23e3d5ac12145c02fcb4b4767d7dfccad782aee5" + version = "v0.23.1" [[projects]] + digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39" name = "github.com/davecgh/go-spew" packages = ["spew"] + pruneopts = "UT" revision = "346938d642f2ec3594ed81d874461961cd0faa76" version = "v1.1.0" [[projects]] - branch = "master" + digest = "1:c7644c73a3d23741fdba8a99b1464e021a224b7e205be497271a8003a15ca41b" name = "github.com/ebuchman/fail-test" packages = ["."] + pruneopts = "UT" revision = "95f809107225be108efcf10a3509e4ea6ceef3c4" [[projects]] + digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd" name = "github.com/fsnotify/fsnotify" packages = ["."] + pruneopts = "UT" revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" version = "v1.4.7" [[projects]] + digest = "1:fdf5169073fb0ad6dc12a70c249145e30f4058647bea25f0abd48b6d9f228a11" name = "github.com/go-kit/kit" packages = [ "log", "log/level", - "log/term" + "log/term", + "metrics", + "metrics/discard", + "metrics/internal/lv", + "metrics/prometheus", ] + pruneopts = "UT" revision = "4dc7be5d2d12881735283bcab7352178e190fc71" version = "v0.6.0" [[projects]] + digest = "1:31a18dae27a29aa074515e43a443abfd2ba6deb6d69309d8d7ce789c45f34659" name = "github.com/go-logfmt/logfmt" packages = ["."] + pruneopts = "UT" revision = "390ab7935ee28ec6b286364bba9b4dd6410cb3d5" version = "v0.3.0" [[projects]] + digest = "1:c4a2528ccbcabf90f9f3c464a5fc9e302d592861bbfd0b7135a7de8a943d0406" name = "github.com/go-stack/stack" packages = ["."] + pruneopts = "UT" revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc" version = "v1.7.0" [[projects]] + digest = "1:35621fe20f140f05a0c4ef662c26c0ab4ee50bca78aa30fe87d33120bd28165e" name = "github.com/gogo/protobuf" packages = [ "gogoproto", @@ -102,49 +153,61 @@ "proto", "protoc-gen-gogo/descriptor", "sortkeys", - "types" + "types", ] - revision = "1adfc126b41513cc696b209667c8656ea7aac67c" - version = "v1.0.0" + pruneopts = "UT" + revision = "636bf0302bc95575d69441b25a2603156ffdddf1" + version = "v1.1.1" [[projects]] + digest = "1:17fe264ee908afc795734e8c4e63db2accabaf57326dbf21763a7d6b86096260" name = "github.com/golang/protobuf" packages = [ "proto", "ptypes", "ptypes/any", "ptypes/duration", - "ptypes/timestamp" + "ptypes/timestamp", ] - revision = "925541529c1fa6821df4e44ce2723319eb2be768" - version = "v1.0.0" + pruneopts = "UT" + revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" + version = "v1.1.0" [[projects]] branch = "master" + digest = "1:4a0c6bb4805508a6287675fac876be2ac1182539ca8a32468d8128882e9d5009" name = "github.com/golang/snappy" packages = ["."] + pruneopts = "UT" revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a" [[projects]] + digest = "1:c79fb010be38a59d657c48c6ba1d003a8aa651fa56b579d959d74573b7dff8e1" name = "github.com/gorilla/context" packages = ["."] + pruneopts = "UT" revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42" version = "v1.1.1" [[projects]] + digest = "1:e73f5b0152105f18bc131fba127d9949305c8693f8a762588a82a48f61756f5f" name = "github.com/gorilla/mux" packages = ["."] + pruneopts = "UT" revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf" version = "v1.6.2" [[projects]] + digest = "1:43dd08a10854b2056e615d1b1d22ac94559d822e1f8b6fcc92c1a1057e85188e" name = "github.com/gorilla/websocket" packages = ["."] + pruneopts = "UT" revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b" version = "v1.2.0" [[projects]] branch = "master" + digest = "1:a361611b8c8c75a1091f00027767f7779b29cb37c456a71b8f2604c88057ab40" name = "github.com/hashicorp/hcl" packages = [ ".", @@ -156,126 +219,206 @@ "hcl/token", "json/parser", "json/scanner", - "json/token" + "json/token", ] + pruneopts = "UT" revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168" [[projects]] - branch = "master" - name = "github.com/howeyc/crc16" - packages = ["."] - revision = "2b2a61e366a66d3efb279e46176e7291001e0354" - -[[projects]] + digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" name = "github.com/inconshreveable/mousetrap" packages = ["."] + pruneopts = "UT" revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" version = "v1.0" [[projects]] branch = "master" + digest = "1:39b27d1381a30421f9813967a5866fba35dc1d4df43a6eefe3b7a5444cb07214" name = "github.com/jmhodges/levigo" packages = ["."] + pruneopts = "UT" revision = "c42d9e0ca023e2198120196f842701bb4c55d7b9" [[projects]] branch = "master" + digest = "1:a64e323dc06b73892e5bb5d040ced475c4645d456038333883f58934abbf6f72" name = "github.com/kr/logfmt" packages = ["."] + pruneopts = "UT" revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0" [[projects]] + digest = "1:c568d7727aa262c32bdf8a3f7db83614f7af0ed661474b24588de635c20024c7" name = "github.com/magiconair/properties" packages = ["."] + pruneopts = "UT" revision = "c2353362d570a7bfa228149c62842019201cfb71" version = "v1.8.0" [[projects]] + digest = "1:d4d17353dbd05cb52a2a52b7fe1771883b682806f68db442b436294926bbfafb" name = "github.com/mattn/go-isatty" packages = ["."] + pruneopts = "UT" revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" version = "v0.0.3" [[projects]] - branch = "master" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b" + digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + pruneopts = "UT" + revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" + version = "v1.0.1" [[projects]] + branch = "master" + digest = "1:5ab79470a1d0fb19b041a624415612f8236b3c06070161a910562f2b2d064355" + name = "github.com/mitchellh/mapstructure" + packages = ["."] + pruneopts = "UT" + revision = "f15292f7a699fcc1a38a80977f80a046874ba8ac" + +[[projects]] + digest = "1:95741de3af260a92cc5c7f3f3061e85273f5a81b5db20d4bd68da74bd521675e" name = "github.com/pelletier/go-toml" packages = ["."] + pruneopts = "UT" revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194" version = "v1.2.0" [[projects]] + digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747" name = "github.com/pkg/errors" packages = ["."] + pruneopts = "UT" revision = "645ef00459ed84a119197bfb8d8205042c6df63d" version = "v0.8.0" [[projects]] + digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe" name = "github.com/pmezard/go-difflib" packages = ["difflib"] + pruneopts = "UT" revision = "792786c7400a136282c1664665ae0a8db921c6c2" version = "v1.0.0" +[[projects]] + digest = "1:c1a04665f9613e082e1209cf288bf64f4068dcd6c87a64bf1c4ff006ad422ba0" + name = "github.com/prometheus/client_golang" + packages = [ + "prometheus", + "prometheus/promhttp", + ] + pruneopts = "UT" + revision = "ae27198cdd90bf12cd134ad79d1366a6cf49f632" + [[projects]] branch = "master" + digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" + name = "github.com/prometheus/client_model" + packages = ["go"] + pruneopts = "UT" + revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f" + +[[projects]] + branch = "master" + digest = "1:63b68062b8968092eb86bedc4e68894bd096ea6b24920faca8b9dcf451f54bb5" + name = "github.com/prometheus/common" + packages = [ + "expfmt", + "internal/bitbucket.org/ww/goautoneg", + "model", + ] + pruneopts = "UT" + revision = "c7de2306084e37d54b8be01f3541a8464345e9a5" + +[[projects]] + branch = "master" + digest = "1:8c49953a1414305f2ff5465147ee576dd705487c35b15918fcd4efdc0cb7a290" + name = "github.com/prometheus/procfs" + packages = [ + ".", + "internal/util", + "nfs", + "xfs", + ] + pruneopts = "UT" + revision = "05ee40e3a273f7245e8777337fc7b46e533a9a92" + +[[projects]] + digest = "1:c4556a44e350b50a490544d9b06e9fba9c286c21d6c0e47f54f3a9214597298c" name = "github.com/rcrowley/go-metrics" packages = ["."] + pruneopts = "UT" revision = "e2704e165165ec55d062f5919b4b29494e9fa790" [[projects]] + digest = "1:bd1ae00087d17c5a748660b8e89e1043e1e5479d0fea743352cda2f8dd8c4f84" name = "github.com/spf13/afero" packages = [ ".", - "mem" + "mem", ] + pruneopts = "UT" revision = "787d034dfe70e44075ccc060d346146ef53270ad" version = "v1.1.1" [[projects]] + digest = "1:516e71bed754268937f57d4ecb190e01958452336fa73dbac880894164e91c1f" name = "github.com/spf13/cast" packages = ["."] + pruneopts = "UT" revision = "8965335b8c7107321228e3e3702cab9832751bac" version = "v1.2.0" [[projects]] + digest = "1:645cabccbb4fa8aab25a956cbcbdf6a6845ca736b2c64e197ca7cbb9d210b939" name = "github.com/spf13/cobra" packages = ["."] + pruneopts = "UT" revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" version = "v0.0.3" [[projects]] branch = "master" + digest = "1:8a020f916b23ff574845789daee6818daf8d25a4852419aae3f0b12378ba432a" name = "github.com/spf13/jwalterweatherman" packages = ["."] - revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394" + pruneopts = "UT" + revision = "14d3d4c518341bea657dd8a226f5121c0ff8c9f2" [[projects]] + digest = "1:dab83a1bbc7ad3d7a6ba1a1cc1760f25ac38cdf7d96a5cdd55cd915a4f5ceaf9" name = "github.com/spf13/pflag" packages = ["."] - revision = "583c0c0531f06d5278b7d917446061adc344b5cd" - version = "v1.0.1" + pruneopts = "UT" + revision = "9a97c102cda95a86cec2345a6f09f55a939babf5" + version = "v1.0.2" [[projects]] + digest = "1:59e7dceb53b4a1e57eb1eb0bf9951ff0c25912df7660004a789b62b4e8cdca3b" name = "github.com/spf13/viper" packages = ["."] + pruneopts = "UT" revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736" version = "v1.0.2" [[projects]] + digest = "1:7e8d267900c7fa7f35129a2a37596e38ed0f11ca746d6d9ba727980ee138f9f6" name = "github.com/stretchr/testify" packages = [ "assert", - "require" + "require", ] - revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686" - version = "v1.2.2" + pruneopts = "UT" + revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71" + version = "v1.2.1" [[projects]] branch = "master" + digest = "1:b3cfb8d82b1601a846417c3f31c03a7961862cb2c98dcf0959c473843e6d9a2b" name = "github.com/syndtr/goleveldb" packages = [ "leveldb", @@ -289,69 +432,91 @@ "leveldb/opt", "leveldb/storage", "leveldb/table", - "leveldb/util" + "leveldb/util", ] - revision = "e2150783cd35f5b607daca48afd8c57ec54cc995" + pruneopts = "UT" + revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445" [[projects]] + digest = "1:8b7ca9e3745cb049a65364d3adbbab63e98d3c43c83cb101cb450c8dac3c3492" name = "github.com/tendermint/abci" - packages = [ - "client", - "example/code", - "example/kvstore", - "server", - "types" - ] - revision = "ebee2fe114020aa49c70bbbae50b7079fc7e7b90" - version = "v0.11.0" + packages = ["types"] + pruneopts = "UT" + revision = "68592f4d8ee34e97db94b7a7976b1309efdb7eb9" + version = "v0.10.0" [[projects]] branch = "master" + digest = "1:087aaa7920e5d0bf79586feb57ce01c35c830396ab4392798112e8aae8c47722" name = "github.com/tendermint/ed25519" packages = [ ".", "edwards25519", - "extra25519" + "extra25519", ] + pruneopts = "UT" revision = "d8387025d2b9d158cf4efb07e7ebf814bcce2057" [[projects]] + digest = "1:e9113641c839c21d8eaeb2c907c7276af1eddeed988df8322168c56b7e06e0e1" name = "github.com/tendermint/go-amino" packages = ["."] - revision = "ed62928576cfcaf887209dc96142cd79cdfff389" - version = "0.9.9" + pruneopts = "UT" + revision = "2106ca61d91029c931fd54968c2bb02dc96b1412" + version = "0.10.1" [[projects]] + digest = "1:82f70bfe58f1a55601d469b928aec5b10b1d85710e6adde40dfea8d9adba939d" name = "github.com/tendermint/go-crypto" packages = [ ".", - "keys", - "keys/bcrypt", - "keys/words", - "keys/words/wordlist" + "tmhash", ] - revision = "915416979bf70efa4bcbf1c6cd5d64c5fff9fc19" - version = "v0.6.2" + pruneopts = "UT" + revision = "6a6b591a3d7592a04b46af95451cb5be3b114f76" + version = "v0.9.0" [[projects]] + digest = "1:d4a15d404afbf591e8be16fcda7f5ac87948d5c7531f9d909fd84cc730ab16e2" name = "github.com/tendermint/iavl" - packages = [ - ".", - "sha256truncated" - ] - revision = "c9206995e8f948e99927f5084a88a7e94ca256da" - version = "v0.8.0-rc0" + packages = ["."] + pruneopts = "UT" + revision = "35f66e53d9b01e83b30de68b931f54b2477a94c9" + version = "v0.9.2" [[projects]] + digest = "1:eb0f8bee357e6c28c9ad5fa074545b5085d0dcf580ba0e7024ab8c3285a5c815" name = "github.com/tendermint/tendermint" packages = [ + "abci/client", + "abci/example/code", + "abci/example/kvstore", + "abci/server", + "abci/types", "blockchain", "cmd/tendermint/commands", "config", "consensus", "consensus/types", + "crypto", + "crypto/armor", + "crypto/ed25519", + "crypto/encoding/amino", + "crypto/merkle", + "crypto/secp256k1", + "crypto/tmhash", + "crypto/xsalsa20symmetric", "evidence", + "libs/autofile", + "libs/bech32", + "libs/cli", + "libs/cli/flags", + "libs/clist", + "libs/common", + "libs/db", "libs/events", + "libs/flowrate", + "libs/log", "libs/pubsub", "libs/pubsub/query", "lite", @@ -380,30 +545,34 @@ "state/txindex/kv", "state/txindex/null", "types", - "version" + "version", ] - revision = "27bd1deabe4ba6a2d9b463b8f3e3f1e31b993e61" - version = "v0.20.0" + pruneopts = "UT" + revision = "d542d2c3945116697f60451e6a407082c41c3cc9" + version = "v0.22.8" [[projects]] + digest = "1:68921ddf468c0db04496dc49cc67948f1727a74520b1f1f06100bce5c65fa08b" name = "github.com/tendermint/tmlibs" packages = [ - "autofile", - "bech32", - "cli", - "cli/flags", - "clist", "common", "db", - "flowrate", "log", - "merkle", - "merkle/tmhash" ] - revision = "0c98d10b4ffbd87978d79c160e835b3d3df241ec" + pruneopts = "UT" + revision = "692f1d86a6e2c0efa698fd1e4541b68c74ffaf38" + version = "v0.8.4" + +[[projects]] + digest = "1:5bd938386bd1f61a581bf8cd6ff2b7b2f79c542929176db4ceb44965440dae07" + name = "github.com/zondax/ledger-goclient" + packages = ["."] + pruneopts = "UT" + revision = "39ba4728c137c75718a21f9b4b3280fa31b9139b" [[projects]] branch = "master" + digest = "1:65a21a9e051d54eb6a3f70c659a765f706a998d9287c302269f4ed8054b2a852" name = "golang.org/x/crypto" packages = [ "blowfish", @@ -413,14 +582,16 @@ "nacl/secretbox", "openpgp/armor", "openpgp/errors", + "pbkdf2", "poly1305", "ripemd160", - "salsa20/salsa" + "salsa20/salsa", ] - revision = "a8fb68e7206f8c78be19b432c58eb52a6aa34462" + pruneopts = "UT" + revision = "de0752318171da717af4ce24d0a2e8626afaeb11" [[projects]] - branch = "master" + digest = "1:d36f55a999540d29b6ea3c2ea29d71c76b1d9853fdcd3e5c5cb4836f2ba118f1" name = "golang.org/x/net" packages = [ "context", @@ -429,17 +600,22 @@ "http2/hpack", "idna", "internal/timeseries", - "trace" + "netutil", + "trace", ] - revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196" + pruneopts = "UT" + revision = "292b43bbf7cb8d35ddf40f8d5100ef3837cced3f" [[projects]] branch = "master" + digest = "1:0316a8ad208917f1d141b077e278980fd5e4594f3a85f835dacbf24d85798252" name = "golang.org/x/sys" packages = ["unix"] - revision = "6c888cc515d3ed83fc103cf1d84468aad274b0a7" + pruneopts = "UT" + revision = "4e1fef5609515ec7a2cee7b5de30ba6d9b438cbf" [[projects]] + digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18" name = "golang.org/x/text" packages = [ "collate", @@ -455,49 +631,102 @@ "unicode/bidi", "unicode/cldr", "unicode/norm", - "unicode/rangetable" + "unicode/rangetable", ] + pruneopts = "UT" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" version = "v0.3.0" [[projects]] + branch = "master" + digest = "1:077c1c599507b3b3e9156d17d36e1e61928ee9b53a5b420f10f28ebd4a0b275c" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] - revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200" + pruneopts = "UT" + revision = "383e8b2c3b9e36c4076b235b32537292176bae20" [[projects]] + digest = "1:2dab32a43451e320e49608ff4542fdfc653c95dcc35d0065ec9c6c3dd540ed74" name = "google.golang.org/grpc" packages = [ ".", "balancer", + "balancer/base", + "balancer/roundrobin", "codes", "connectivity", "credentials", - "grpclb/grpc_lb_v1/messages", + "encoding", + "encoding/proto", "grpclog", "internal", + "internal/backoff", + "internal/channelz", + "internal/grpcrand", "keepalive", "metadata", "naming", "peer", "resolver", + "resolver/dns", + "resolver/passthrough", "stats", "status", "tap", - "transport" + "transport", ] - revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e" - version = "v1.7.5" + pruneopts = "UT" + revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8" + version = "v1.13.0" [[projects]] + digest = "1:342378ac4dcb378a5448dd723f0784ae519383532f5e70ade24132c4c8693202" name = "gopkg.in/yaml.v2" packages = ["."] + pruneopts = "UT" revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183" version = "v2.2.1" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "ffb18db87921d091119ab0ab7fa8daaeb76c646d5dbd6796724ff1e8dc41e044" + input-imports = [ + "github.com/cosmos/cosmos-sdk/baseapp", + "github.com/cosmos/cosmos-sdk/client", + "github.com/cosmos/cosmos-sdk/client/keys", + "github.com/cosmos/cosmos-sdk/client/rpc", + "github.com/cosmos/cosmos-sdk/client/tx", + "github.com/cosmos/cosmos-sdk/server", + "github.com/cosmos/cosmos-sdk/server/config", + "github.com/cosmos/cosmos-sdk/types", + "github.com/cosmos/cosmos-sdk/version", + "github.com/cosmos/cosmos-sdk/wire", + "github.com/cosmos/cosmos-sdk/x/auth", + "github.com/cosmos/cosmos-sdk/x/auth/client/cli", + "github.com/cosmos/cosmos-sdk/x/bank", + "github.com/cosmos/cosmos-sdk/x/bank/client/cli", + "github.com/cosmos/cosmos-sdk/x/gov", + "github.com/cosmos/cosmos-sdk/x/ibc", + "github.com/cosmos/cosmos-sdk/x/slashing", + "github.com/cosmos/cosmos-sdk/x/slashing/client/cli", + "github.com/cosmos/cosmos-sdk/x/stake", + "github.com/cosmos/cosmos-sdk/x/stake/client/cli", + "github.com/spf13/cobra", + "github.com/spf13/pflag", + "github.com/spf13/viper", + "github.com/stretchr/testify/assert", + "github.com/stretchr/testify/require", + "github.com/tendermint/abci/types", + "github.com/tendermint/go-crypto", + "github.com/tendermint/tendermint/abci/types", + "github.com/tendermint/tendermint/crypto", + "github.com/tendermint/tendermint/libs/cli", + "github.com/tendermint/tendermint/libs/common", + "github.com/tendermint/tendermint/libs/db", + "github.com/tendermint/tendermint/libs/log", + "github.com/tendermint/tendermint/types", + "github.com/tendermint/tmlibs/db", + "github.com/tendermint/tmlibs/log", + ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 056c1dec..e06b8bf1 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,60 +1,58 @@ -# [[constraint]] -# name = "github.com/bgentry/speakeasy" -# version = "~0.1.0" - -# [[constraint]] -# name = "github.com/golang/protobuf" -# version = "~1.0.0" - -# [[constraint]] -# name = "github.com/mattn/go-isatty" -# version = "~0.0.3" - -# [[constraint]] -# name = "github.com/pkg/errors" -# version = "~0.8.0" - [[constraint]] + name = "github.com/cosmos/cosmos-sdk" + version="=0.23.1" + + +# Copied from cosmos-sdk, constraints switched to overrides + +[[override]] + name = "github.com/bgentry/speakeasy" + version = "~0.1.0" + +[[override]] + name = "github.com/golang/protobuf" + version = "=1.1.0" + +[[override]] + name = "github.com/mattn/go-isatty" + version = "~0.0.3" + +[[override]] name = "github.com/spf13/cobra" version = "~0.0.1" -# [[constraint]] -# name = "github.com/spf13/viper" -# version = "~1.0.0" +[[override]] + name = "github.com/spf13/viper" + version = "~1.0.0" -[[constraint]] +[[override]] + name = "github.com/pkg/errors" + version = "=0.8.0" + +[[override]] name = "github.com/stretchr/testify" - version = "~1.2.1" - -[[constraint]] - name = "github.com/tendermint/abci" - version = "=0.11.0" - -[[constraint]] - name = "github.com/tendermint/go-crypto" - version = "~0.6.2" - -# [[constraint]] -# name = "github.com/tendermint/go-amino" -# version = "=0.9.9" - -# [[constraint]] -# name = "github.com/tendermint/iavl" -# version = "0.8.0-rc0" - -# [[constraint]] -# name = "github.com/tendermint/tendermint" -# version = "=0.20.0" + version = "=1.2.1" [[override]] - name = "github.com/tendermint/tmlibs" - revision = "0c98d10b4ffbd87978d79c160e835b3d3df241ec" + name = "github.com/tendermint/go-amino" + version = "=0.10.1" -# this got updated and broke, so locked to an old working commit ... [[override]] - name = "google.golang.org/genproto" - revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200" + name = "github.com/tendermint/iavl" + version = "=v0.9.2" + +[[override]] + name = "github.com/tendermint/tendermint" + version = "=v0.22.8" + +[[override]] + name = "github.com/bartekn/go-bip39" + branch = "master" + +[[override]] + name = "github.com/zondax/ledger-goclient" + revision = "39ba4728c137c75718a21f9b4b3280fa31b9139b" [prune] go-tests = true - unused-packages = true \ No newline at end of file + unused-packages = true diff --git a/README.md b/README.md index bd1a7c38..c6dfe0eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,97 @@ -# Kava Blockchain +![Kava](https://raw.githubusercontent.com/Kava-Labs/kava/master/kava-logo.svg) -## Installation +--- - go install ./cmd/kvd - go install ./cmd/kvcli +A decentralized fast-finality blockchain for interoperable payment channel networks. +Building on the work of Tendermint and Interledger. + +Project status: We're currently in a very early public testnet. With future features being implemented. + +Try it out - send txs using our public node, or run a full node to sync to the testnet, or even run a validator. + + + +## Install + +### Source + +Requirements: go installed and set up. + + mkdir -p $GOPATH/src/github.com/kava-labs + cd $GOPATH/src/github.com/kava-labs + git clone https://github.com/kava-labs/kava + cd kava + go install ./cmd/kvd + go install ./cmd/kvcli + + + +### Docker + +TODO + + + + + +## Run a Full Node + + kvd init --name --chain-id kava-test-0 + +This will generate config and keys in `$HOME/.kvd` and `$HOME/.kvcli`. +The default password is 'password'. + +Copy the testnet genesis file (from https://raw.githubusercontent.com/Kava-Labs/kava/master/testnets/kava-test-1/genesis.json) into `$HOME/.kvd/config/`, replacing the existing one. + +Add the kava node address (`0dfd43e440e34fc193ddee4ae99547184f3cb5d1@validator.connector.kava.io:26656`) to `seeds` in `$HOME/.kvd/config/config.toml` + +Start your full node + + kvd start + + +## Run a Validator +Join the [validator chat](https://riot.im/app/#/room/#kava-validators:matrix.org). Follow setup for a full node above. +Get you address with `kvcli keys list`. Should look like `cosmosaccaddr10jpp289accvkhsvrpz4tlj9zhqdaey2tl9m4rg`. +Ask @rhuairahrighairidh in the chat to give you some coins. + +Get your validator pubkey with `kvd tendermint show_validator` + + kvcli stake create-validator \ + --amount 1000KVA \ + --pubkey \ + --address-validator \ + --moniker "" \ + --chain-id kava-test-0 \ + --from + +Now you should be participating in consensus and validating blocks! + + +Running a validator requires that you keep validating blocks. If you stop then your stake will be slashed. +In order to stop validating, first remove yourself as validator, then you can stop your node. + + kvcli stake unbond begin \ + --address-delegator \ + --address-validator \ + --chain-id kava-test-0 \ + --shares-percent 1 \ + --from \ No newline at end of file diff --git a/cmd/kvcli/main.go b/cmd/kvcli/main.go index 48c0876b..c9ff604b 100644 --- a/cmd/kvcli/main.go +++ b/cmd/kvcli/main.go @@ -1,11 +1,9 @@ package main import ( - "os" - "github.com/spf13/cobra" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" @@ -15,15 +13,15 @@ import ( "github.com/cosmos/cosmos-sdk/version" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" + //govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli" //ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/client/cli" - //stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli" + slashingcmd "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" + stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli" "github.com/kava-labs/kava/internal/app" - "github.com/kava-labs/kava/internal/lcd" - //"github.com/kava-labs/kava/internal/types" + //"github.com/kava-labs/kava/internal/lcd" ) -// rootCmd is the entry point for this binary var ( rootCmd = &cobra.Command{ Use: "kvcli", @@ -32,49 +30,119 @@ var ( ) func main() { - // disable sorting cobra.EnableCommandSorting = false // get the codec - cdc := app.MakeCodec() + cdc := app.CreateKavaAppCodec() - // TODO: setup keybase, viper object, etc. to be passed into - // the below functions and eliminate global vars, like we do - // with the cdc - - // add standard rpc, and tx commands + // add standard rpc commands rpc.AddCommands(rootCmd) - rootCmd.AddCommand(client.LineBreak) - tx.AddCommands(rootCmd, cdc) - rootCmd.AddCommand(client.LineBreak) - // add query/post commands (custom to binary) + //Add state commands + tendermintCmd := &cobra.Command{ + Use: "tendermint", + Short: "Tendermint state querying subcommands", + } + tendermintCmd.AddCommand( + rpc.BlockCommand(), + rpc.ValidatorCommand(), + ) + tx.AddCommands(tendermintCmd, cdc) + + //Add IBC commands + // ibcCmd := &cobra.Command{ + // Use: "ibc", + // Short: "Inter-Blockchain Communication subcommands", + // } + // ibcCmd.AddCommand( + // client.PostCommands( + // ibccmd.IBCTransferCmd(cdc), + // ibccmd.IBCRelayCmd(cdc), + // )...) + + advancedCmd := &cobra.Command{ + Use: "advanced", + Short: "Advanced subcommands", + } + + advancedCmd.AddCommand( + tendermintCmd, + //ibcCmd, + //lcd.ServeCommand(cdc), + ) + rootCmd.AddCommand( + advancedCmd, + client.LineBreak, + ) + + //Add stake commands + stakeCmd := &cobra.Command{ + Use: "stake", + Short: "Stake and validation subcommands", + } + stakeCmd.AddCommand( + client.GetCommands( + stakecmd.GetCmdQueryValidator("stake", cdc), + stakecmd.GetCmdQueryValidators("stake", cdc), + stakecmd.GetCmdQueryDelegation("stake", cdc), + stakecmd.GetCmdQueryDelegations("stake", cdc), + slashingcmd.GetCmdQuerySigningInfo("slashing", cdc), + )...) + stakeCmd.AddCommand( + client.PostCommands( + stakecmd.GetCmdCreateValidator(cdc), + stakecmd.GetCmdEditValidator(cdc), + stakecmd.GetCmdDelegate(cdc), + stakecmd.GetCmdUnbond("stake", cdc), + stakecmd.GetCmdRedelegate("stake", cdc), + slashingcmd.GetCmdUnrevoke(cdc), + )...) + rootCmd.AddCommand( + stakeCmd, + ) + + //Add stake commands + // govCmd := &cobra.Command{ + // Use: "gov", + // Short: "Governance and voting subcommands", + // } + // govCmd.AddCommand( + // client.GetCommands( + // govcmd.GetCmdQueryProposal("gov", cdc), + // govcmd.GetCmdQueryVote("gov", cdc), + // govcmd.GetCmdQueryVotes("gov", cdc), + // )...) + // govCmd.AddCommand( + // client.PostCommands( + // govcmd.GetCmdSubmitProposal(cdc), + // govcmd.GetCmdDeposit(cdc), + // govcmd.GetCmdVote(cdc), + // )...) + // rootCmd.AddCommand( + // govCmd, + // ) + + //Add auth and bank commands rootCmd.AddCommand( client.GetCommands( authcmd.GetAccountCmd("acc", cdc, authcmd.GetAccountDecoder(cdc)), )...) - rootCmd.AddCommand( client.PostCommands( bankcmd.SendTxCmd(cdc), - //ibccmd.IBCTransferCmd(cdc), - //ibccmd.IBCRelayCmd(cdc), - //stakecmd.GetCmdCreateValidator(cdc), - //stakecmd.GetCmdEditValidator(cdc), - //stakecmd.GetCmdDelegate(cdc), - //stakecmd.GetCmdUnbond(cdc), )...) // add proxy, version and key info rootCmd.AddCommand( - client.LineBreak, - lcd.ServeCommand(cdc), keys.Commands(), client.LineBreak, version.VersionCmd, ) // prepare and add flags - executor := cli.PrepareMainCmd(rootCmd, "KV", os.ExpandEnv("$HOME/.kvcli")) - executor.Execute() + executor := cli.PrepareMainCmd(rootCmd, "KV", app.DefaultCLIHome) + err := executor.Execute() + if err != nil { + panic(err) + } } diff --git a/cmd/kvd/main.go b/cmd/kvd/main.go index 3231ce4d..fd291af2 100644 --- a/cmd/kvd/main.go +++ b/cmd/kvd/main.go @@ -2,45 +2,60 @@ package main import ( "encoding/json" - "os" + "io" + + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/spf13/cobra" + "github.com/spf13/viper" - abci "github.com/tendermint/abci/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" - "github.com/tendermint/tmlibs/cli" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" "github.com/cosmos/cosmos-sdk/server" "github.com/kava-labs/kava/internal/app" ) func main() { - cdc := app.MakeCodec() + // Create an app codec + cdc := app.CreateKavaAppCodec() + + // Create a server context (a struct of a tendermint config and a logger) ctx := server.NewDefaultContext() + // Create the root kvd command + cobra.EnableCommandSorting = false rootCmd := &cobra.Command{ Use: "kvd", Short: "Kava Daemon", PersistentPreRunE: server.PersistentPreRunEFn(ctx), } - server.AddCommands(ctx, cdc, rootCmd, app.CreateAppInit(), - server.ConstructAppCreator(newApp, "kava"), - server.ConstructAppExporter(exportAppStateAndTMValidators, "kava")) + // Add server commands to kvd, passing in the app + appInit := app.KavaAppInit() + appCreator := server.ConstructAppCreator(newApp, "kava") // init db before calling newApp + appExporter := server.ConstructAppExporter(exportAppStateAndTMValidators, "kava") - // prepare and add flags - rootDir := os.ExpandEnv("$HOME/.kvd") - executor := cli.PrepareBaseCmd(rootCmd, "KV", rootDir) - executor.Execute() + server.AddCommands(ctx, cdc, rootCmd, appInit, appCreator, appExporter) + + // handle envs and add some flags and stuff + executor := cli.PrepareBaseCmd(rootCmd, "KV", app.DefaultNodeHome) + + // Run kvd + err := executor.Execute() + if err != nil { + panic(err) + } } -func newApp(logger log.Logger, db dbm.DB) abci.Application { - return app.NewKavaApp(logger, db) +func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { + return app.NewKavaApp(logger, db, traceStore, baseapp.SetPruning(viper.GetString("pruning"))) } -func exportAppStateAndTMValidators(logger log.Logger, db dbm.DB) (json.RawMessage, []tmtypes.GenesisValidator, error) { - bapp := app.NewKavaApp(logger, db) - return bapp.ExportAppStateAndValidators() +func exportAppStateAndTMValidators(logger log.Logger, db dbm.DB, traceStore io.Writer) (json.RawMessage, []tmtypes.GenesisValidator, error) { + tempApp := app.NewKavaApp(logger, db, traceStore) + return tempApp.ExportAppStateAndValidators() } diff --git a/deployment/README.md b/deployment/README.md deleted file mode 100644 index 7060aa75..00000000 --- a/deployment/README.md +++ /dev/null @@ -1,19 +0,0 @@ -To initialise a network: - - - delete everything (including persistant volume claim) - - deploy everything except the deployments - - wait until the job has finished, then deploy the deployments - - Note on config - - - Secrets and configmaps need to be generated from files - - Ideally everything would be in one file but kubectl doesn't scan directories yet: https://github.com/kubernetes/kubernetes/issues/62421 - - `kubectl create secret generic kava-user-keys --from-file=./init/init-data --dry-run -o yaml > secret-user.yml` - - `kubectl create secret generic kava-node-config --from-file=./init/init-data/.kvd/config --dry-run -o yaml > secret-config.yml` - -Examples of using light client with the node: - - - Get the status `kvcli status --node :46657 --chain-id test-kava` - - Send coins `kvcli send --name --to --amount 100KVA --node :46657 --chain-id test-kava` - - Run the light client daemon `kvcli rest-server --node :46657 --chain-id test-kava` - \ No newline at end of file diff --git a/deployment/deployments/deployment-d.yml b/deployment/deployments/deployment-d.yml deleted file mode 100644 index 500d2866..00000000 --- a/deployment/deployments/deployment-d.yml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: apps/v1beta2 -kind: Deployment -metadata: - name: kava-d-deployment2 - labels: - app: kava -spec: - replicas: 1 - selector: - matchLabels: - pod: kvd - template: - metadata: - labels: - app: kava - pod: kvd - spec: - containers: - - name: kvd - image: kava/kava - command: ["kvd", "start"] - ports: - - containerPort: 46656 - - containerPort: 46657 - volumeMounts: - - name: persistent-storage-kvd - mountPath: /root/.kvd - volumes: - - name: persistent-storage-kvd - persistentVolumeClaim: - claimName: kava-pvc-kvd2 diff --git a/deployment/deployments/deployment-lcd.yml b/deployment/deployments/deployment-lcd.yml deleted file mode 100644 index 8ed5d36f..00000000 --- a/deployment/deployments/deployment-lcd.yml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: apps/v1beta2 -kind: Deployment -metadata: - name: kava-lcd-deployment2 - labels: - app: kava -spec: - replicas: 1 - selector: - matchLabels: - pod: kvcli-lcd - template: - metadata: - labels: - app: kava - pod: kvcli-lcd - spec: - containers: - - name: kvcli-lcd - image: kava/kava - command: ["kvcli", "rest-server", "--chain-id=test-kava", "--node=kava-d-service2:46657", "--laddr=tcp://0.0.0.0:1317"] - ports: - - containerPort: 1317 - volumeMounts: - - name: persistent-storage-kvcli - mountPath: /root/.kvcli - volumes: - - name: persistent-storage-kvcli - persistentVolumeClaim: - claimName: kava-pvc-kvcli2 \ No newline at end of file diff --git a/deployment/init/Dockerfile b/deployment/init/Dockerfile deleted file mode 100644 index a1ec8fd3..00000000 --- a/deployment/init/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM kava/kava -WORKDIR / -COPY init.sh ./ -# Expects init data to be mounted at /init-data -CMD ["sh", "init.sh"] diff --git a/deployment/init/init.sh b/deployment/init/init.sh deleted file mode 100644 index de41a45a..00000000 --- a/deployment/init/init.sh +++ /dev/null @@ -1,19 +0,0 @@ -# Setup node and light client. -echo "This assumes you have wiped old data" - -echo "copying kvd config to the default location ($HOME/.kvd)" -initData=./init-data -cp -vR $initData/.kvd/. $HOME/.kvd/ # copy contents of .kvd into .kvd, creating dir if necessary - - -echo "setup validator key from seed" -validatorPassword="$(cat $initData/validatorPassword)" -echo $validatorPassword -validatorBackupPhrase="$(cat $initData/validatorBackupPhrase)" -printf "$validatorPassword\n$validatorBackupPhrase\n" | kvcli keys add --recover validator - - -echo "setup user1 key from seed" -user1Password="$(cat ./init-data/user1Password)" -user1BackupPhrase="$(cat ./init-data/user1BackupPhrase)" -printf "$user1Password\n$user1BackupPhrase\n" | kvcli keys add --recover user1 diff --git a/deployment/job.yml b/deployment/job.yml deleted file mode 100644 index caaa7f20..00000000 --- a/deployment/job.yml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: kava-init-data2 - labels: - app: kava -spec: - template: - spec: - containers: - - name: run-init - image: kava/kava-init - volumeMounts: - - name: kava-persistent-storage-kvd - mountPath: /root/.kvd - - name: kava-persistent-storage-kvcli - mountPath: /root/.kvcli - - name: user-keys - mountPath: /init-data/ - - name: node-config - mountPath: /init-data/.kvd/config/ - restartPolicy: Never - volumes: - - name: kava-persistent-storage-kvd - persistentVolumeClaim: - claimName: kava-pvc-kvd2 - - name: kava-persistent-storage-kvcli - persistentVolumeClaim: - claimName: kava-pvc-kvcli2 - - name: user-keys - secret: - secretName: kava-user-keys - - name: node-config - secret: - secretName: kava-node-config - diff --git a/deployment/service.yml b/deployment/service.yml deleted file mode 100644 index b345c28c..00000000 --- a/deployment/service.yml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: kava-d-service2 - labels: - app: kava -spec: - type: LoadBalancer - ports: - - name: rpc - port: 46657 - protocol: TCP - targetPort: 46657 - - name: p2p - port: 46656 - protocol: TCP - targetPort: 46656 - selector: - pod: kvd ---- -apiVersion: v1 -kind: Service -metadata: - name: kava-lcd-service2 - labels: - app: kava -spec: - type: LoadBalancer - ports: - - name: rest-server - port: 1317 - protocol: TCP - targetPort: 1317 - selector: - pod: kvcli-lcd diff --git a/deployment/volume.yml b/deployment/volume.yml deleted file mode 100644 index de0c970c..00000000 --- a/deployment/volume.yml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: kava-pvc-kvd2 - labels: - app: kava -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 8Gi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: kava-pvc-kvcli2 - labels: - app: kava -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 8Gi - diff --git a/docker-compose.yml b/docker-compose.yml index a0979c1f..4a4a2ddd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,18 +4,18 @@ services: image: kava/kava command: ["kvd", "start"] ports: - - 46657:46657 - volumes: - - ~/.kvd:/root/.kvd - - ~/.kvcli:/root/.kvcli - # Avoid printing out all the tendermint logs - logging: - driver: "none" - lcd: - image: kava/kava - command: "kvcli rest-server --chain-id test-kava --node kvd:46657 --laddr tcp://0.0.0.0:1317" - ports: - - 1317:1317 + - 26657:26657 volumes: - ~/.kvd:/root/.kvd - ~/.kvcli:/root/.kvcli + # # Avoid printing out all the tendermint logs + # logging: + # driver: "none" + # lcd: + # image: kava/kava + # command: "kvcli rest-server --chain-id test-kava --node kvd:46657 --laddr tcp://0.0.0.0:1317" + # ports: + # - 1317:1317 + # volumes: + # - ~/.kvd:/root/.kvd + # - ~/.kvcli:/root/.kvcli diff --git a/internal/app/app.go b/internal/app/app.go index e62665db..ed117c28 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -2,29 +2,36 @@ package app import ( "encoding/json" + "io" + "os" - abci "github.com/tendermint/abci/types" + abci "github.com/tendermint/tendermint/abci/types" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" + //"github.com/cosmos/cosmos-sdk/x/gov" //"github.com/cosmos/cosmos-sdk/x/ibc" - //"github.com/cosmos/cosmos-sdk/x/slashing" - //"github.com/cosmos/cosmos-sdk/x/stake" - "github.com/kava-labs/kava/internal/types" + "github.com/cosmos/cosmos-sdk/x/slashing" + "github.com/cosmos/cosmos-sdk/x/stake" ) const ( appName = "KavaApp" ) -// Extended ABCI application +// Set default directories for data +var ( + DefaultCLIHome = os.ExpandEnv("$HOME/.kvcli") + DefaultNodeHome = os.ExpandEnv("$HOME/.kvd") +) + type KavaApp struct { *bam.BaseApp cdc *wire.Codec @@ -32,61 +39,78 @@ type KavaApp struct { // keys to access the substores keyMain *sdk.KVStoreKey keyAccount *sdk.KVStoreKey - //keyIBC *sdk.KVStoreKey - //keyStake *sdk.KVStoreKey - //keySlashing *sdk.KVStoreKey + //keyIBC *sdk.KVStoreKey + keyStake *sdk.KVStoreKey + keySlashing *sdk.KVStoreKey + //keyGov *sdk.KVStoreKey + keyFeeCollection *sdk.KVStoreKey - // Manage getting and setting accounts + // keepers accountMapper auth.AccountMapper feeCollectionKeeper auth.FeeCollectionKeeper coinKeeper bank.Keeper //ibcMapper ibc.Mapper - //stakeKeeper stake.Keeper - //slashingKeeper slashing.Keeper + stakeKeeper stake.Keeper + slashingKeeper slashing.Keeper + //govKeeper gov.Keeper } -func NewKavaApp(logger log.Logger, db dbm.DB) *KavaApp { +// Creates a new KavaApp. +func NewKavaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*bam.BaseApp)) *KavaApp { - // Create app-level codec for txs and accounts. - var cdc = MakeCodec() + // Create a codec for use across the whole app + cdc := CreateKavaAppCodec() - // Create your application object. + // Create a new base app + bApp := bam.NewBaseApp(appName, cdc, logger, db, baseAppOptions...) + bApp.SetCommitMultiStoreTracer(traceStore) + + // Create the kava app, extending baseApp var app = &KavaApp{ - BaseApp: bam.NewBaseApp(appName, cdc, logger, db), + BaseApp: bApp, cdc: cdc, keyMain: sdk.NewKVStoreKey("main"), keyAccount: sdk.NewKVStoreKey("acc"), //keyIBC: sdk.NewKVStoreKey("ibc"), - //keyStake: sdk.NewKVStoreKey("stake"), - //keySlashing: sdk.NewKVStoreKey("slashing"), + keyStake: sdk.NewKVStoreKey("stake"), + keySlashing: sdk.NewKVStoreKey("slashing"), + //keyGov: sdk.NewKVStoreKey("gov"), + keyFeeCollection: sdk.NewKVStoreKey("fee"), } - // Define the accountMapper. + // Define the accountMapper and base account app.accountMapper = auth.NewAccountMapper( cdc, - app.keyAccount, // target store - &auth.BaseAccount{}, + app.keyAccount, + auth.ProtoBaseAccount, ) - // add accountMapper/handlers + // Create the keepers app.coinKeeper = bank.NewKeeper(app.accountMapper) //app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace)) - //app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace)) - //app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.RegisterCodespace(slashing.DefaultCodespace)) + app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace)) + app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.RegisterCodespace(slashing.DefaultCodespace)) + //app.govKeeper = gov.NewKeeper(app.cdc, app.keyGov, app.coinKeeper, app.stakeKeeper, app.RegisterCodespace(gov.DefaultCodespace)) + app.feeCollectionKeeper = auth.NewFeeCollectionKeeper(app.cdc, app.keyFeeCollection) - // register message routes + // Register the message handlers app.Router(). - AddRoute("auth", auth.NewHandler(app.accountMapper)). - AddRoute("bank", bank.NewHandler(app.coinKeeper)) + AddRoute("bank", bank.NewHandler(app.coinKeeper)). //AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)). - //AddRoute("stake", stake.NewHandler(app.stakeKeeper)) + AddRoute("stake", stake.NewHandler(app.stakeKeeper)). + AddRoute("slashing", slashing.NewHandler(app.slashingKeeper)) + //AddRoute("gov", gov.NewHandler(app.govKeeper)) - // Initialize BaseApp. + // Set func to initialze the chain from appState in genesis file app.SetInitChainer(app.initChainer) + + // Set functions that run before and after txs / blocks app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) app.SetAnteHandler(auth.NewAnteHandler(app.accountMapper, app.feeCollectionKeeper)) - app.MountStoresIAVL(app.keyMain, app.keyAccount) //, app.keyIBC, app.keyStake, app.keySlashing) + + // Mount stores + app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyStake, app.keySlashing, app.keyFeeCollection) err := app.LoadLatestVersion(app.keyMain) if err != nil { cmn.Exit(err.Error()) @@ -94,95 +118,90 @@ func NewKavaApp(logger log.Logger, db dbm.DB) *KavaApp { return app } -// Custom tx codec -func MakeCodec() *wire.Codec { - var cdc = wire.NewCodec() - wire.RegisterCrypto(cdc) // Register crypto. - sdk.RegisterWire(cdc) // Register Msgs - bank.RegisterWire(cdc) - //stake.RegisterWire(cdc) - //slashing.RegisterWire(cdc) +// Creates a codec for use across the whole app. +func CreateKavaAppCodec() *wire.Codec { + cdc := wire.NewCodec() //ibc.RegisterWire(cdc) + bank.RegisterWire(cdc) + stake.RegisterWire(cdc) + slashing.RegisterWire(cdc) + //gov.RegisterWire(cdc) auth.RegisterWire(cdc) - - // register custom AppAccount - //cdc.RegisterInterface((*auth.Account)(nil), nil) - //cdc.RegisterConcrete(&types.BaseAccount{}, "kava/Account", nil) + sdk.RegisterWire(cdc) + wire.RegisterCrypto(cdc) return cdc } -// application updates every end block +// The function baseapp runs on receipt of a BeginBlock ABCI message func (app *KavaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - //tags := slashing.BeginBlocker(ctx, req, app.slashingKeeper) + tags := slashing.BeginBlocker(ctx, req, app.slashingKeeper) - //return abci.ResponseBeginBlock{ - // Tags: tags.ToKVPairs(), - //} - return abci.ResponseBeginBlock{} + return abci.ResponseBeginBlock{ + Tags: tags.ToKVPairs(), + } } -// application updates every end block +// The function baseapp runs on receipt of a EndBlock ABCI message func (app *KavaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - //validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper) + validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper) - //return abci.ResponseEndBlock{ - // ValidatorUpdates: validatorUpdates, - //} - return abci.ResponseEndBlock{} + //tags, _ := gov.EndBlocker(ctx, app.govKeeper) + + return abci.ResponseEndBlock{ + ValidatorUpdates: validatorUpdates, + //Tags: tags, + } } -// Custom logic for initialization +// Initialzes the app db from the appState in the genesis file. Baseapp runs this on receipt of an InitChain ABCI message func (app *KavaApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { stateJSON := req.AppStateBytes - genesisState := new(types.GenesisState) - err := app.cdc.UnmarshalJSON(stateJSON, genesisState) + var genesisState GenesisState + err := app.cdc.UnmarshalJSON(stateJSON, &genesisState) if err != nil { - panic(err) // TODO https://github.com/cosmos/cosmos-sdk/issues/468 - // return sdk.ErrGenesisParse("").TraceCause(err, "") + panic(err) } + // load the accounts for _, gacc := range genesisState.Accounts { - acc, err := gacc.ToAppAccount() - if err != nil { - panic(err) // TODO https://github.com/cosmos/cosmos-sdk/issues/468 - // return sdk.ErrGenesisParse("").TraceCause(err, "") - } + acc := gacc.ToAccount() acc.AccountNumber = app.accountMapper.GetNextAccountNumber(ctx) app.accountMapper.SetAccount(ctx, acc) } // load the initial stake information - //stake.InitGenesis(ctx, app.stakeKeeper, genesisState.StakeData) + err = stake.InitGenesis(ctx, app.stakeKeeper, genesisState.StakeData) + if err != nil { + panic(err) + } + + //gov.InitGenesis(ctx, app.govKeeper, gov.DefaultGenesisState()) return abci.ResponseInitChain{} } -// Custom logic for state export +// func (app *KavaApp) ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { ctx := app.NewContext(true, abci.Header{}) // iterate to get the accounts - accounts := []types.GenesisAccount{} + accounts := []GenesisAccount{} appendAccount := func(acc auth.Account) (stop bool) { - account := types.GenesisAccount{ - Address: acc.GetAddress(), - Coins: acc.GetCoins(), - } + account := NewGenesisAccountI(acc) accounts = append(accounts, account) return false } app.accountMapper.IterateAccounts(ctx, appendAccount) - genState := types.GenesisState{ - Accounts: accounts, + genState := GenesisState{ + Accounts: accounts, + StakeData: stake.WriteGenesis(ctx, app.stakeKeeper), } appState, err = wire.MarshalJSONIndent(app.cdc, genState) if err != nil { return nil, nil, err } - - validators = make([]tmtypes.GenesisValidator, 0) // TODO export the actual validators - - return appState, validators, err + validators = stake.WriteValidators(ctx, app.stakeKeeper) + return appState, validators, nil } diff --git a/internal/app/genesis.go b/internal/app/genesis.go index fdb3a714..02c76fc7 100644 --- a/internal/app/genesis.go +++ b/internal/app/genesis.go @@ -4,20 +4,220 @@ import ( "encoding/json" "errors" - //"github.com/spf13/pflag" - //"github.com/spf13/viper" - crypto "github.com/tendermint/go-crypto" + "github.com/spf13/pflag" + "github.com/tendermint/tendermint/crypto" tmtypes "github.com/tendermint/tendermint/types" "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" - //"github.com/cosmos/cosmos-sdk/x/stake" - - "github.com/kava-labs/kava/internal/types" + "github.com/cosmos/cosmos-sdk/x/stake" ) +var ( + // Tokens given to genesis validators and accounts + numStartingTokensValidators = int64(1000) + numStartingTokensAccounts = int64(99000) +) + +// Initial app state to be written to (and read from) genesis file +type GenesisState struct { + Accounts []GenesisAccount `json:"accounts"` + StakeData stake.GenesisState `json:"stake"` +} + +// A simplified version of a normal account. It doesn't have pubkey or sequence. +type GenesisAccount struct { + Address sdk.AccAddress `json:"address"` + Coins sdk.Coins `json:"coins"` +} + +// TODO remove? +func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount { + return GenesisAccount{ + Address: acc.Address, + Coins: acc.Coins, + } +} + +// TODO remove? +func NewGenesisAccountI(acc auth.Account) GenesisAccount { + return GenesisAccount{ + Address: acc.GetAddress(), + Coins: acc.GetCoins(), + } +} + +// Converts a GenesisAccount to auth.BaseAccount TODO rename +func (ga *GenesisAccount) ToAccount() (acc *auth.BaseAccount) { + return &auth.BaseAccount{ + Address: ga.Address, + Coins: ga.Coins.Sort(), + } +} + +// Create the appInit stuct for server init command +func KavaAppInit() server.AppInit { + fsAppGenState := pflag.NewFlagSet("", pflag.ContinueOnError) + fsAppGenTx := pflag.NewFlagSet("", pflag.ContinueOnError) + + fsAppGenTx.String(server.FlagName, "", "validator moniker, required") + fsAppGenTx.String(server.FlagClientHome, DefaultCLIHome, + "home directory for the client, used for key generation") + fsAppGenTx.Bool(server.FlagOWK, false, "overwrite the accounts created") + + return server.AppInit{ + FlagsAppGenState: fsAppGenState, + FlagsAppGenTx: fsAppGenTx, + AppGenTx: KavaAppGenTx, + AppGenState: KavaAppGenStateJSON, + } +} + +// Define format for GenTx json +type KavaGenTx struct { + Name string `json:"name"` + Address sdk.AccAddress `json:"address"` + PubKey string `json:"pub_key"` +} + +// Generate a genesis transsction +func KavaAppGenTx(cdc *wire.Codec, pk crypto.PubKey, genTxConfig config.GenTx) ( + appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { + + // Generate address and secret key for the validator + if genTxConfig.Name == "" { + return nil, nil, tmtypes.GenesisValidator{}, errors.New("Must specify --name (validator moniker)") + } + var addr sdk.AccAddress + var secret string + addr, secret, err = server.GenerateSaveCoinKey(genTxConfig.CliRoot, genTxConfig.Name, "password", genTxConfig.Overwrite) + if err != nil { + return + } + + // Create string to print out + mm := map[string]string{"secret": secret} + var bz []byte + bz, err = cdc.MarshalJSON(mm) + if err != nil { + return + } + cliPrint = json.RawMessage(bz) + + // Create genTx and validator + appGenTx, _, validator, err = KavaAppGenTxNF(cdc, pk, addr, genTxConfig.Name) + + return +} + +// TODO combine with KavaAppGenTx +func KavaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.AccAddress, name string) ( + appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { + + // Create the gentx + var bz []byte + genTx := KavaGenTx{ + Name: name, + Address: addr, + PubKey: sdk.MustBech32ifyAccPub(pk), + } + bz, err = wire.MarshalJSONIndent(cdc, genTx) + if err != nil { + return + } + appGenTx = json.RawMessage(bz) + + // Create the validator + validator = tmtypes.GenesisValidator{ + PubKey: pk, + Power: numStartingTokensValidators, + } + return +} + +// Create the core parameters for genesis initialization +// note that the pubkey input is this machines pubkey +func KavaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState GenesisState, err error) { + + if len(appGenTxs) == 0 { + err = errors.New("must provide at least 1 genesis transaction") + return + } + + // start with the default staking genesis state + stakeData := stake.DefaultGenesisState() + // change denom of staking coin + stakeData.Params.BondDenom = "KVA" + + // get genesis flag account information + genaccs := make([]GenesisAccount, len(appGenTxs)) + for i, appGenTx := range appGenTxs { + + var genTx KavaGenTx + err = cdc.UnmarshalJSON(appGenTx, &genTx) + if err != nil { + return + } + + // create the genesis account + accAuth := auth.NewBaseAccountWithAddress(genTx.Address) + accAuth.Coins = sdk.Coins{ + {"KVA", sdk.NewInt(numStartingTokensAccounts)}, + } + acc := NewGenesisAccount(&accAuth) + genaccs[i] = acc + stakeData.Pool.LooseTokens = stakeData.Pool.LooseTokens.Add(sdk.NewRat(numStartingTokensAccounts)) // increase the supply + + // add the validator + if len(genTx.Name) > 0 { + desc := stake.NewDescription(genTx.Name, "", "", "") + validator := stake.NewValidator(genTx.Address, + sdk.MustGetAccPubKeyBech32(genTx.PubKey), desc) + + stakeData.Pool.LooseTokens = stakeData.Pool.LooseTokens.Add(sdk.NewRat(numStartingTokensValidators)) // increase the supply + + // add some new shares to the validator + var issuedDelShares sdk.Rat + validator, stakeData.Pool, issuedDelShares = validator.AddTokensFromDel(stakeData.Pool, numStartingTokensValidators) + stakeData.Validators = append(stakeData.Validators, validator) + + // create the self-delegation from the issuedDelShares + delegation := stake.Delegation{ + DelegatorAddr: validator.Owner, + ValidatorAddr: validator.Owner, + Shares: issuedDelShares, + Height: 0, + } + + stakeData.Bonds = append(stakeData.Bonds, delegation) + } + } + + // create the final app state + genesisState = GenesisState{ + Accounts: genaccs, + StakeData: stakeData, + } + return +} + +// Run KavaAppGenState then convert to JSON +func KavaAppGenStateJSON(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { + + // create the final app state + genesisState, err := KavaAppGenState(cdc, appGenTxs) + if err != nil { + return nil, err + } + appState, err = wire.MarshalJSONIndent(cdc, genesisState) + return +} + +/* + // A file, genesis.json, is created with the initial state of the kava network. // This is done by creating an AppInit object to be handed to the server when it creates commands. // When `kvd init` is run, a genesis tx is created. Then, from that, an initial app state. @@ -29,11 +229,11 @@ func CreateAppInit() server.AppInit { } } -func KavaAppGenTx(cdc *wire.Codec, pk crypto.PubKey) ( +func KavaAppGenTx(cdc *wire.Codec, pk crypto.PubKey, genTxConfig config.GenTx) ( appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { // Generate address and secret key for the validator - var addr sdk.Address + var addr sdk.AccAddress var secret string addr, secret, err = server.GenerateCoinKey() if err != nil { @@ -103,204 +303,4 @@ func KavaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState jso return } -/* - -// --------------------- default init -------------------------- - -// simple default application init -var DefaultAppInit = AppInit{ - AppGenTx: SimpleAppGenTx, - AppGenState: SimpleAppGenState, -} - -// simple genesis tx -type SimpleGenTx struct { - Addr sdk.Address `json:"addr"` -} - -// Generate a genesis transaction -func SimpleAppGenTx(cdc *wire.Codec, pk crypto.PubKey) ( - appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { - - var addr sdk.Address - var secret string - addr, secret, err = GenerateCoinKey() - if err != nil { - return - } - - var bz []byte - simpleGenTx := SimpleGenTx{addr} - bz, err = cdc.MarshalJSON(simpleGenTx) - if err != nil { - return - } - appGenTx = json.RawMessage(bz) - - mm := map[string]string{"secret": secret} - bz, err = cdc.MarshalJSON(mm) - if err != nil { - return - } - cliPrint = json.RawMessage(bz) - - validator = tmtypes.GenesisValidator{ - PubKey: pk, - Power: 10, - } - return -} - -// create the genesis app state -func SimpleAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { - - if len(appGenTxs) != 1 { - err = errors.New("must provide a single genesis transaction") - return - } - - var genTx SimpleGenTx - err = cdc.UnmarshalJSON(appGenTxs[0], &genTx) - if err != nil { - return - } - - appState = json.RawMessage(fmt.Sprintf(`{ - "accounts": [{ - "address": "%s", - "coins": [ - { - "denom": "mycoin", - "amount": 9007199254740992 - } - ] - }] -}`, genTx.Addr.String())) - return -} - - -// -------------------- gaia init ---------------------- - -// simple genesis tx -type GaiaGenTx struct { - Name string `json:"name"` - Address sdk.Address `json:"address"` - PubKey crypto.PubKey `json:"pub_key"` -} - -// Generate a gaia genesis transaction with flags -func GaiaAppGenTx(cdc *wire.Codec, pk crypto.PubKey) ( - appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { - clientRoot := viper.GetString(flagClientHome) - overwrite := viper.GetBool(flagOWK) - name := viper.GetString(flagName) - if name == "" { - return nil, nil, tmtypes.GenesisValidator{}, errors.New("Must specify --name (validator moniker)") - } - - var addr sdk.Address - var secret string - addr, secret, err = server.GenerateSaveCoinKey(clientRoot, name, "1234567890", overwrite) - if err != nil { - return - } - mm := map[string]string{"secret": secret} - var bz []byte - bz, err = cdc.MarshalJSON(mm) - if err != nil { - return - } - cliPrint = json.RawMessage(bz) - appGenTx,_,validator,err = GaiaAppGenTxNF(cdc, pk, addr, name, overwrite) - return -} - -// Generate a gaia genesis transaction without flags -func GaiaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.Address, name string, overwrite bool) ( - appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { - - var bz []byte - gaiaGenTx := GaiaGenTx{ - Name: name, - Address: addr, - PubKey: pk, - } - bz, err = wire.MarshalJSONIndent(cdc, gaiaGenTx) - if err != nil { - return - } - appGenTx = json.RawMessage(bz) - - validator = tmtypes.GenesisValidator{ - PubKey: pk, - Power: freeFermionVal, - } - return -} - -// Create the core parameters for genesis initialization for gaia -// note that the pubkey input is this machines pubkey -func GaiaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState GenesisState, err error) { - - if len(appGenTxs) == 0 { - err = errors.New("must provide at least genesis transaction") - return - } - - // start with the default staking genesis state - stakeData := stake.DefaultGenesisState() - - // get genesis flag account information - genaccs := make([]GenesisAccount, len(appGenTxs)) - for i, appGenTx := range appGenTxs { - - var genTx GaiaGenTx - err = cdc.UnmarshalJSON(appGenTx, &genTx) - if err != nil { - return - } - - // create the genesis account, give'm few steaks and a buncha token with there name - accAuth := auth.NewBaseAccountWithAddress(genTx.Address) - accAuth.Coins = sdk.Coins{ - {genTx.Name + "Token", 1000}, - {"steak", freeFermionsAcc}, - } - acc := NewGenesisAccount(&accAuth) - genaccs[i] = acc - stakeData.Pool.LooseUnbondedTokens += freeFermionsAcc // increase the supply - - // add the validator - if len(genTx.Name) > 0 { - desc := stake.NewDescription(genTx.Name, "", "", "") - validator := stake.NewValidator(genTx.Address, genTx.PubKey, desc) - validator.PoolShares = stake.NewBondedShares(sdk.NewRat(freeFermionVal)) - stakeData.Validators = append(stakeData.Validators, validator) - - // pool logic - stakeData.Pool.BondedTokens += freeFermionVal - stakeData.Pool.BondedShares = sdk.NewRat(stakeData.Pool.BondedTokens) - } - } - - // create the final app state - genesisState = GenesisState{ - Accounts: genaccs, - StakeData: stakeData, - } - return -} - -// GaiaAppGenState but with JSON -func GaiaAppGenStateJSON(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { - - // create the final app state - genesisState, err := GaiaAppGenState(cdc, appGenTxs) - if err != nil { - return nil, err - } - appState, err = wire.MarshalJSONIndent(cdc, genesisState) - return -} */ diff --git a/internal/lcd/decode.go b/internal/lcd/decode.go index 96769dd9..59bb5f9a 100644 --- a/internal/lcd/decode.go +++ b/internal/lcd/decode.go @@ -1,5 +1,6 @@ package lcd +/* import ( "net/http" //"encoding/hex" @@ -10,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" ) +*/ type TxBody struct { TxBase64 string `json:"txbase64"` diff --git a/internal/lcd/root.go b/internal/lcd/root.go index 6bd82cff..b6266fa4 100644 --- a/internal/lcd/root.go +++ b/internal/lcd/root.go @@ -1,5 +1,6 @@ package lcd +/* import ( "net/http" "os" @@ -24,6 +25,7 @@ import ( //ibc "github.com/cosmos/cosmos-sdk/x/ibc/client/rest" //stake "github.com/cosmos/cosmos-sdk/x/stake/client/rest" ) +*/ // ServeCommand will generate a long-running rest server // (aka Light Client Daemon) that exposes functionality similar diff --git a/internal/lcd/wire.go b/internal/lcd/wire.go index f146e102..c5d4c7cf 100644 --- a/internal/lcd/wire.go +++ b/internal/lcd/wire.go @@ -1,9 +1,11 @@ package lcd +/* import ( amino "github.com/tendermint/go-amino" ctypes "github.com/tendermint/tendermint/rpc/core/types" ) +*/ var cdc = amino.NewCodec() diff --git a/internal/types/genesis.go b/internal/types/genesis.go index ac15e42e..9212fc0b 100644 --- a/internal/types/genesis.go +++ b/internal/types/genesis.go @@ -1,5 +1,8 @@ package types +// DEPRECATED + +/* import ( sdk "github.com/cosmos/cosmos-sdk/types" crypto "github.com/tendermint/go-crypto" @@ -41,7 +44,7 @@ func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder { } */ //___________________________________________________________________________________ - +/* type GenTx struct { Address sdk.Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` @@ -75,3 +78,4 @@ func (ga *GenesisAccount) ToAppAccount() (acc *auth.BaseAccount, err error) { Coins: ga.Coins.Sort(), }, nil } +*/ diff --git a/kava-logo.svg b/kava-logo.svg new file mode 100644 index 00000000..01a6c6f5 --- /dev/null +++ b/kava-logo.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/testnets/kava-test-0/genesis.json b/testnets/kava-test-0/genesis.json new file mode 100644 index 00000000..e35c55a2 --- /dev/null +++ b/testnets/kava-test-0/genesis.json @@ -0,0 +1,99 @@ +{ + "genesis_time": "2018-08-16T20:19:19.700191483Z", + "chain_id": "kava-test-0", + "consensus_params": { + "block_size_params": { + "max_bytes": "22020096", + "max_txs": "10000", + "max_gas": "-1" + }, + "tx_size_params": { + "max_bytes": "10240", + "max_gas": "-1" + }, + "block_gossip_params": { + "block_part_size_bytes": "65536" + }, + "evidence_params": { + "max_age": "100000" + } + }, + "validators": [ + { + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "dnl/bkhWxCMuq5ia4AWwU4r2HRl+MJjU4bSS0qsmI/0=" + }, + "power": "500000", + "name": "" + } + ], + "app_hash": "", + "app_state": { + "accounts": [ + { + "address": "cosmosaccaddr10fa3g29glhkekp6nhsqq4njwrpv69kl9zt4a7q", + "coins": [ + { + "denom": "KVA", + "amount": "500000" + } + ] + } + ], + "stake": { + "pool": { + "loose_tokens": "1000000", + "bonded_tokens": "0", + "inflation_last_time": "0", + "inflation": "7/100", + "date_last_commission_reset": "0", + "prev_bonded_shares": "0" + }, + "params": { + "inflation_rate_change": "13/100", + "inflation_max": "1/5", + "inflation_min": "7/100", + "goal_bonded": "67/100", + "unbonding_time": "259200", + "max_validators": 100, + "bond_denom": "KVA" + }, + "validators": [ + { + "owner": "cosmosaccaddr10fa3g29glhkekp6nhsqq4njwrpv69kl9zt4a7q", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "dnl/bkhWxCMuq5ia4AWwU4r2HRl+MJjU4bSS0qsmI/0=" + }, + "revoked": false, + "status": 0, + "tokens": "500000", + "delegator_shares": "500000", + "description": { + "moniker": "kava-validator", + "identity": "", + "website": "", + "details": "" + }, + "bond_height": "0", + "bond_intra_tx_counter": 0, + "proposer_reward_pool": [], + "commission": "0", + "commission_max": "0", + "commission_change_rate": "0", + "commission_change_today": "0", + "prev_bonded_tokens": "0" + } + ], + "bonds": [ + { + "delegator_addr": "cosmosaccaddr10fa3g29glhkekp6nhsqq4njwrpv69kl9zt4a7q", + "validator_addr": "cosmosaccaddr10fa3g29glhkekp6nhsqq4njwrpv69kl9zt4a7q", + "shares": "500000", + "height": "0" + } + ] + } + } +} \ No newline at end of file diff --git a/testnets/kava-test-1/genesis.json b/testnets/kava-test-1/genesis.json new file mode 100644 index 00000000..c56b2244 --- /dev/null +++ b/testnets/kava-test-1/genesis.json @@ -0,0 +1,99 @@ +{ + "genesis_time": "2018-08-17T20:36:46.515426797Z", + "chain_id": "kava-test-1", + "consensus_params": { + "block_size_params": { + "max_bytes": "22020096", + "max_txs": "10000", + "max_gas": "-1" + }, + "tx_size_params": { + "max_bytes": "10240", + "max_gas": "-1" + }, + "block_gossip_params": { + "block_part_size_bytes": "65536" + }, + "evidence_params": { + "max_age": "100000" + } + }, + "validators": [ + { + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "2XxN3kL5CWNyI9x4o3+iG//R+BVyTwmhx0ZVNGQOAjo=" + }, + "power": "1000", + "name": "" + } + ], + "app_hash": "", + "app_state": { + "accounts": [ + { + "address": "cosmosaccaddr1fr2eescsy22uw93x9df2dernrd6llyar66e4gy", + "coins": [ + { + "denom": "KVA", + "amount": "99000" + } + ] + } + ], + "stake": { + "pool": { + "loose_tokens": "100000", + "bonded_tokens": "0", + "inflation_last_time": "0", + "inflation": "7/100", + "date_last_commission_reset": "0", + "prev_bonded_shares": "0" + }, + "params": { + "inflation_rate_change": "13/100", + "inflation_max": "1/5", + "inflation_min": "7/100", + "goal_bonded": "67/100", + "unbonding_time": "259200", + "max_validators": 100, + "bond_denom": "KVA" + }, + "validators": [ + { + "owner": "cosmosaccaddr1fr2eescsy22uw93x9df2dernrd6llyar66e4gy", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "2XxN3kL5CWNyI9x4o3+iG//R+BVyTwmhx0ZVNGQOAjo=" + }, + "revoked": false, + "status": 0, + "tokens": "1000", + "delegator_shares": "1000", + "description": { + "moniker": "kava-validator", + "identity": "", + "website": "", + "details": "" + }, + "bond_height": "0", + "bond_intra_tx_counter": 0, + "proposer_reward_pool": [], + "commission": "0", + "commission_max": "0", + "commission_change_rate": "0", + "commission_change_today": "0", + "prev_bonded_tokens": "0" + } + ], + "bonds": [ + { + "delegator_addr": "cosmosaccaddr1fr2eescsy22uw93x9df2dernrd6llyar66e4gy", + "validator_addr": "cosmosaccaddr1fr2eescsy22uw93x9df2dernrd6llyar66e4gy", + "shares": "1000", + "height": "0" + } + ] + } + } +} \ No newline at end of file