diff --git a/bchain/coins/blockchain.go b/bchain/coins/blockchain.go index 75c905ea1e..ddfa1a80e2 100644 --- a/bchain/coins/blockchain.go +++ b/bchain/coins/blockchain.go @@ -12,6 +12,7 @@ import ( "blockbook/bchain/coins/fujicoin" "blockbook/bchain/coins/gamecredits" "blockbook/bchain/coins/grs" + "blockbook/bchain/coins/koto" "blockbook/bchain/coins/liquid" "blockbook/bchain/coins/litecoin" "blockbook/bchain/coins/monacoin" @@ -51,6 +52,8 @@ func init() { BlockChainFactories["Dash"] = dash.NewDashRPC BlockChainFactories["Dash Testnet"] = dash.NewDashRPC BlockChainFactories["GameCredits"] = gamecredits.NewGameCreditsRPC + BlockChainFactories["Koto"] = koto.NewKotoRPC + BlockChainFactories["Koto Testnet"] = koto.NewKotoRPC BlockChainFactories["Litecoin"] = litecoin.NewLitecoinRPC BlockChainFactories["Litecoin Testnet"] = litecoin.NewLitecoinRPC BlockChainFactories["Dogecoin"] = dogecoin.NewDogecoinRPC diff --git a/bchain/coins/koto/kotoparser.go b/bchain/coins/koto/kotoparser.go new file mode 100644 index 0000000000..e84a220f28 --- /dev/null +++ b/bchain/coins/koto/kotoparser.go @@ -0,0 +1,92 @@ +package koto + +import ( + "blockbook/bchain" + "blockbook/bchain/coins/btc" + + "github.com/martinboehm/btcd/wire" + "github.com/martinboehm/btcutil/chaincfg" +) + +const ( + MainnetMagic wire.BitcoinNet = 0x6f746f4b + TestnetMagic wire.BitcoinNet = 0x6f6b6f54 + RegtestMagic wire.BitcoinNet = 0x6f6b6552 +) + +var ( + MainNetParams chaincfg.Params + TestNetParams chaincfg.Params + RegtestParams chaincfg.Params +) + +func init() { + MainNetParams = chaincfg.MainNetParams + MainNetParams.Net = MainnetMagic + + // Address encoding magics + MainNetParams.AddressMagicLen = 2 + MainNetParams.PubKeyHashAddrID = []byte{0x18, 0x36} // base58 prefix: k1 + MainNetParams.ScriptHashAddrID = []byte{0x18, 0x3B} // base58 prefix: k3 + + TestNetParams = chaincfg.TestNet3Params + TestNetParams.Net = TestnetMagic + + // Address encoding magics + TestNetParams.AddressMagicLen = 2 + TestNetParams.PubKeyHashAddrID = []byte{0x18, 0xA4} // base58 prefix: km + TestNetParams.ScriptHashAddrID = []byte{0x18, 0x39} // base58 prefix: k2 + + RegtestParams = chaincfg.RegressionNetParams + RegtestParams.Net = RegtestMagic +} + +// KotoParser handle +type KotoParser struct { + *btc.BitcoinParser + baseparser *bchain.BaseParser +} + +// NewKotoParser returns new KotoParser instance +func NewKotoParser(params *chaincfg.Params, c *btc.Configuration) *KotoParser { + return &KotoParser{ + BitcoinParser: btc.NewBitcoinParser(params, c), + baseparser: &bchain.BaseParser{}, + } +} + +// GetChainParams contains network parameters for the main Koto network, +// the regression test Koto network, the test Koto network and +// the simulation test Koto network, in this order +func GetChainParams(chain string) *chaincfg.Params { + if !chaincfg.IsRegistered(&MainNetParams) { + err := chaincfg.Register(&MainNetParams) + if err == nil { + err = chaincfg.Register(&TestNetParams) + } + if err == nil { + err = chaincfg.Register(&RegtestParams) + } + if err != nil { + panic(err) + } + } + switch chain { + case "test": + return &TestNetParams + case "regtest": + return &RegtestParams + default: + return &MainNetParams + } +} + +// PackTx packs transaction to byte array using protobuf +func (p *KotoParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error) { + return p.baseparser.PackTx(tx, height, blockTime) +} + +// UnpackTx unpacks transaction from protobuf byte array +func (p *KotoParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error) { + return p.baseparser.UnpackTx(buf) +} diff --git a/bchain/coins/koto/kotoparser_test.go b/bchain/coins/koto/kotoparser_test.go new file mode 100644 index 0000000000..45caae2ab3 --- /dev/null +++ b/bchain/coins/koto/kotoparser_test.go @@ -0,0 +1,240 @@ +// +build unittest + +package koto + +import ( + "blockbook/bchain" + "blockbook/bchain/coins/btc" + "bytes" + "encoding/hex" + "math/big" + "os" + "reflect" + "testing" + + "github.com/martinboehm/btcutil/chaincfg" +) + +var ( + testTx1, testTx2 bchain.Tx + + testTxPacked1 = "0a2097f944e3558cc784f4013b3753ce9570fe4707893eda724b12eb4c69686113a612970f020000000001036b2048020000001976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac000000000100000000000000001392204802000000a8a3d9a54a3fe3b5ae208fa2d96faea96dac6cb76b03bb2e32c5dd892a5d6f6490f05d8f6fb4401228df1be9f22c5ad69706c461bbc9253ffbc3531770e5075e149ec6af7f2cda0cb87862620792340bc425095115adbf0f16f4d3ece3f5c467cbcb02b01ced7192ab644f96fa01f04a7a450a42da2bfad1748634f7bc141467d3c94961ed6250dd23fca62b30b4a2ca6fbad0724372a429bcb97a28954e1681c0bb974877dac26eb2b994eaa23d56ecfdedd93f8331f9432f12adc37da9f049585179b7bbb370b76c6c37a438a20bc3b410a6a72ff8d11408a337a37bbc73dd15df8a34f2c878dc6d6db4f0cee504680fe53e0a158f1e1c82b84e065a4764fc57f8bf75d28899126917a05bf3230036f2d6b38f8a51214d1c2d0588a95e82f0032c2dfa6916c689f8daa648c01517bbf0826d2d4082067b0d17071920eb6dab6c0307603b825f3aae347db349628d4fcaa97a155ef1a2c601170fe825609efa964f0a06700afc135542ea7b06fc989424d7e100652c0ad5be4ca01c1fd676530e6f60606c5feb7de5da0d69544d8b7be8de06b27ba96a1bfa6bc07cc0269982acb722032a938ab36089c0eeda7a4076cd258a1752486a3d52af16db8dff072bcc61f17503185b5bc8aa0ea3a181663bb0ddd3cca1a19293764b01569b9878a60c0ce82e21020751a4ecc1a2a9b9a123042ee8d8a5d4d3f4764b1cdb13d57d2a77c3b56bd89102302d118ebc14969ade27bf83f0e707a97b26c7292a6c20e850abce5fad0ab59d032fec0d6278bbe0f2fb3fbc61697ba10b6ec3f2c4196e46e98dfb65bb28ec6afff81de5a4be7be8c4f56ab4c03043a3cf9987b630ac4b6d8aa74ce8ed5b61040262239172c6450f9ab642e2f2d258c200c3bb4ad69011ef2dfe1dd63d758c86270ac4925b248b9bb4b6c9ff7bf2e56260cba02b2429648dc20eb034c8f9b18e1f6a38b8651c236554546585b4dd0f07fd5ee1696bf792527ce84b22012439300797103f22d3969df725e4414d899ec32a2ebbb857cc911e374e84738f4e007ee5260ff666a286e45c465525e2e3fc5e5e0e9ad82e53d364e4fd355619711c616d508470b997af44f62f283871cd892552128135aadb40c6f8cf69ee72acf349e9f4d33e8673450b9f69d4022a8d886b0cdbaba0798e0bf57b42dedfafb0bbd5495ca1c0030bbf460b48f9a138f6ab748df9046d9995f895062583ce0818e40afb9704653e11d58ca42bd3f60f4e908589ad9144c76067dc433cad13a5bbd9c168691b8c6cddb19d812f3e3f98e2cdd20dbb170936fd5cd2ef0bca72af8931a1b01d6081ffbef5be4416e696a7c762a375b368f71dc31362a4005750992a48e55311dde8d2013180d62e507ffc3e468c4a27acc763a9651b19f37e1ffca7e656225617368e79c1d18f9b14d770993d3d1dc42dcfd9adfa02a8ddf0ebc8fbb850fab307fd1d239cf6ad4e5ff40992dd974bc43fa351ce807cc0036c2f7d80bbd052f496216304fbc63e8d728bf129acaedb0073aff077e584ce04bc1ccf9c91f41f3c8804dd65da4ecdfdba32590e04b4d1b6895dea8edacd1f40313e8a1d4900d0dba54056eee72e3d155e9c67e7a51df581c33cbd39f16549d590ae5387fe2c5ad3484ad5c7da320066b79083c49879e45938b3bbb063726008a2ebb8847c9e57be6ec489c7aaa80f5e8e430040cb8d60298363df850cb7b4e98e97192882d10d2fd96cc490dd18b263d96aac6aa4f5583770e0917fa9b566dd0e0b218c6684007ec10cf11747e8f039fac5250170de2835ab88fea356b6a7d0f5e81ffe9b78d191a745e0237a256a2a840880689d83503b72462e3955b61e22afde947c1f1527ea94151c5b7d3a72ce68979603911c08bcec01097899fd30347be7f2e246f70d2af6a1e29b54988978a91f79b2ed8be76ffd62f79de5418933ed166be919d9bbb7524347d87d31afaed05e71a82b09c18c196b3ba6e226939b375903f7d889422863567203814484af89fd223ce1c959b1fdffaf26461630c630d2bbf99228a096ea6cb0d61df70d24414c76bf9371c4abff0ad257098189af6ea32200fbe092d875aa4d3f72a7ec138439e4b08fb1dcde6a90f25fde1498773e693c9b21c40505d42edcbcaed8a2dc4642750e9df73e169f9986ddb3a57991ac2cb3b540d788e2c2c22c2c51b2d74a98ed59a8cec89ba54342fb9660449a116f8691da60cb447afe4d5e80f37b4669e6007c1cadc41933fb27bab41afd312c37e5cb43715cb4013efcd91221ed06249540b733c05e81131aba75ba0f427d9bd975554b2d49a8048f0b3a84477e75290235fd3bbcaee6c4438ba72299dd960f3f6ee9241f7e399684e894d7bb1c302ecbe24d0f19dca982a82ee44f36211d23b0ea623c9c9f4f527f4e452fd06ebb943cadeea3d7fa42cabd25324bc5851e40f9952823f56b50b97729e6561f2100c2b5922860c6cf447a668324ca931f2f35a5edb7d306f8b8802f98cf67140a3fe73099ab86bb65c439a8593e64816bcd46aa4c254918f4a3a0f3f47b4ebcfb2824703f9a7d163824484ce6fe1852c4ba131ee2635de14822a8cb3782697fecc6f69514edd3f42fcf2751075b838bf14ae91e9dcff517bf3cec4db1b986b4c966a4fa40d38f2ebb7fc60218c397a2d705200028d09a0c3a490a050248206b0310001a1976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac22236b31323257767a46415565444b3667353238563376726547673870614a5137624248364000" + testTxPacked2 = "0a203aebcf5a223450bca3c0312d3d87b6070447e795d09a266a3a01c70e44c7cc4812e1010100000001cbc2c0b14b26f563ceee8201971b2caae2a4f964d0fd91267290c51a6a171411010000006a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c07467224ffffffff02c0c62d00000000001976a914dd985697513887236c484acc605ece839e2204ac88ac989e8ce0000000001976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac0000000018ff98a2d705200028d49a0c3298010a0012201114176a1ac590722691fdd064f9a4e2aa2c1b970182eece63f5264bb1c0c2cb1801226a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c0746722428ffffffff0f3a470a032dc6c010001a1976a914dd985697513887236c484acc605ece839e2204ac88ac22236b314a334461347236356653616b6571555953616a6f506f74656376633768384861513a480a04e08c9e9810011a1976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac22236b31396b7355666462355139584b556a3565645570314451686e6343503868396845374000" +) + +func init() { + testTx1 = bchain.Tx{ + Hex: "020000000001036b2048020000001976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac000000000100000000000000001392204802000000a8a3d9a54a3fe3b5ae208fa2d96faea96dac6cb76b03bb2e32c5dd892a5d6f6490f05d8f6fb4401228df1be9f22c5ad69706c461bbc9253ffbc3531770e5075e149ec6af7f2cda0cb87862620792340bc425095115adbf0f16f4d3ece3f5c467cbcb02b01ced7192ab644f96fa01f04a7a450a42da2bfad1748634f7bc141467d3c94961ed6250dd23fca62b30b4a2ca6fbad0724372a429bcb97a28954e1681c0bb974877dac26eb2b994eaa23d56ecfdedd93f8331f9432f12adc37da9f049585179b7bbb370b76c6c37a438a20bc3b410a6a72ff8d11408a337a37bbc73dd15df8a34f2c878dc6d6db4f0cee504680fe53e0a158f1e1c82b84e065a4764fc57f8bf75d28899126917a05bf3230036f2d6b38f8a51214d1c2d0588a95e82f0032c2dfa6916c689f8daa648c01517bbf0826d2d4082067b0d17071920eb6dab6c0307603b825f3aae347db349628d4fcaa97a155ef1a2c601170fe825609efa964f0a06700afc135542ea7b06fc989424d7e100652c0ad5be4ca01c1fd676530e6f60606c5feb7de5da0d69544d8b7be8de06b27ba96a1bfa6bc07cc0269982acb722032a938ab36089c0eeda7a4076cd258a1752486a3d52af16db8dff072bcc61f17503185b5bc8aa0ea3a181663bb0ddd3cca1a19293764b01569b9878a60c0ce82e21020751a4ecc1a2a9b9a123042ee8d8a5d4d3f4764b1cdb13d57d2a77c3b56bd89102302d118ebc14969ade27bf83f0e707a97b26c7292a6c20e850abce5fad0ab59d032fec0d6278bbe0f2fb3fbc61697ba10b6ec3f2c4196e46e98dfb65bb28ec6afff81de5a4be7be8c4f56ab4c03043a3cf9987b630ac4b6d8aa74ce8ed5b61040262239172c6450f9ab642e2f2d258c200c3bb4ad69011ef2dfe1dd63d758c86270ac4925b248b9bb4b6c9ff7bf2e56260cba02b2429648dc20eb034c8f9b18e1f6a38b8651c236554546585b4dd0f07fd5ee1696bf792527ce84b22012439300797103f22d3969df725e4414d899ec32a2ebbb857cc911e374e84738f4e007ee5260ff666a286e45c465525e2e3fc5e5e0e9ad82e53d364e4fd355619711c616d508470b997af44f62f283871cd892552128135aadb40c6f8cf69ee72acf349e9f4d33e8673450b9f69d4022a8d886b0cdbaba0798e0bf57b42dedfafb0bbd5495ca1c0030bbf460b48f9a138f6ab748df9046d9995f895062583ce0818e40afb9704653e11d58ca42bd3f60f4e908589ad9144c76067dc433cad13a5bbd9c168691b8c6cddb19d812f3e3f98e2cdd20dbb170936fd5cd2ef0bca72af8931a1b01d6081ffbef5be4416e696a7c762a375b368f71dc31362a4005750992a48e55311dde8d2013180d62e507ffc3e468c4a27acc763a9651b19f37e1ffca7e656225617368e79c1d18f9b14d770993d3d1dc42dcfd9adfa02a8ddf0ebc8fbb850fab307fd1d239cf6ad4e5ff40992dd974bc43fa351ce807cc0036c2f7d80bbd052f496216304fbc63e8d728bf129acaedb0073aff077e584ce04bc1ccf9c91f41f3c8804dd65da4ecdfdba32590e04b4d1b6895dea8edacd1f40313e8a1d4900d0dba54056eee72e3d155e9c67e7a51df581c33cbd39f16549d590ae5387fe2c5ad3484ad5c7da320066b79083c49879e45938b3bbb063726008a2ebb8847c9e57be6ec489c7aaa80f5e8e430040cb8d60298363df850cb7b4e98e97192882d10d2fd96cc490dd18b263d96aac6aa4f5583770e0917fa9b566dd0e0b218c6684007ec10cf11747e8f039fac5250170de2835ab88fea356b6a7d0f5e81ffe9b78d191a745e0237a256a2a840880689d83503b72462e3955b61e22afde947c1f1527ea94151c5b7d3a72ce68979603911c08bcec01097899fd30347be7f2e246f70d2af6a1e29b54988978a91f79b2ed8be76ffd62f79de5418933ed166be919d9bbb7524347d87d31afaed05e71a82b09c18c196b3ba6e226939b375903f7d889422863567203814484af89fd223ce1c959b1fdffaf26461630c630d2bbf99228a096ea6cb0d61df70d24414c76bf9371c4abff0ad257098189af6ea32200fbe092d875aa4d3f72a7ec138439e4b08fb1dcde6a90f25fde1498773e693c9b21c40505d42edcbcaed8a2dc4642750e9df73e169f9986ddb3a57991ac2cb3b540d788e2c2c22c2c51b2d74a98ed59a8cec89ba54342fb9660449a116f8691da60cb447afe4d5e80f37b4669e6007c1cadc41933fb27bab41afd312c37e5cb43715cb4013efcd91221ed06249540b733c05e81131aba75ba0f427d9bd975554b2d49a8048f0b3a84477e75290235fd3bbcaee6c4438ba72299dd960f3f6ee9241f7e399684e894d7bb1c302ecbe24d0f19dca982a82ee44f36211d23b0ea623c9c9f4f527f4e452fd06ebb943cadeea3d7fa42cabd25324bc5851e40f9952823f56b50b97729e6561f2100c2b5922860c6cf447a668324ca931f2f35a5edb7d306f8b8802f98cf67140a3fe73099ab86bb65c439a8593e64816bcd46aa4c254918f4a3a0f3f47b4ebcfb2824703f9a7d163824484ce6fe1852c4ba131ee2635de14822a8cb3782697fecc6f69514edd3f42fcf2751075b838bf14ae91e9dcff517bf3cec4db1b986b4c966a4fa40d38f2ebb7fc602", + Blocktime: 1525189571, + Time: 1525189571, + Txid: "97f944e3558cc784f4013b3753ce9570fe4707893eda724b12eb4c69686113a6", + LockTime: 0, + Vin: []bchain.Vin{ + }, + Vout: []bchain.Vout{ + { + ValueSat: *big.NewInt(9800018691), + N: 0, + ScriptPubKey: bchain.ScriptPubKey{ + Hex: "76a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac", + Addresses: []string{ + "k122WvzFAUeDK6g528V3vreGg8paJQ7bBH6", + }, + }, + }, + }, + } + + testTx2 = bchain.Tx{ + Hex: "0100000001cbc2c0b14b26f563ceee8201971b2caae2a4f964d0fd91267290c51a6a171411010000006a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c07467224ffffffff02c0c62d00000000001976a914dd985697513887236c484acc605ece839e2204ac88ac989e8ce0000000001976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac00000000", + Blocktime: 1525189759, + Time: 1525189759, + Txid: "3aebcf5a223450bca3c0312d3d87b6070447e795d09a266a3a01c70e44c7cc48", + LockTime: 0, + Vin: []bchain.Vin{ + { + ScriptSig: bchain.ScriptSig{ + Hex: "473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c07467224", + }, + Txid: "1114176a1ac590722691fdd064f9a4e2aa2c1b970182eece63f5264bb1c0c2cb", + Vout: 1, + Sequence: 4294967295, + }, + }, + Vout: []bchain.Vout{ + { + ValueSat: *big.NewInt(3000000), + N: 0, + ScriptPubKey: bchain.ScriptPubKey{ + Hex: "76a914dd985697513887236c484acc605ece839e2204ac88ac", + Addresses: []string{ + "k1J3Da4r65fSakeqUYSajoPotecvc7h8HaQ", + }, + }, + }, + { + ValueSat: *big.NewInt(3767312024), + N: 1, + ScriptPubKey: bchain.ScriptPubKey{ + Hex: "76a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac", + Addresses: []string{ + "k19ksUfdb5Q9XKUj5edUp1DQhncCP8h9hE7", + }, + }, + }, + }, + } +} + +func TestMain(m *testing.M) { + c := m.Run() + chaincfg.ResetParams() + os.Exit(c) +} + +func TestGetAddrDesc(t *testing.T) { + type args struct { + tx bchain.Tx + parser *KotoParser + } + tests := []struct { + name string + args args + }{ + { + name: "koto-1", + args: args{ + tx: testTx1, + parser: NewKotoParser(GetChainParams("main"), &btc.Configuration{}), + }, + }, + { + name: "koto-2", + args: args{ + tx: testTx2, + parser: NewKotoParser(GetChainParams("main"), &btc.Configuration{}), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + for n, vout := range tt.args.tx.Vout { + got1, err := tt.args.parser.GetAddrDescFromVout(&vout) + if err != nil { + t.Errorf("getAddrDescFromVout() error = %v, vout = %d", err, n) + return + } + got2, err := tt.args.parser.GetAddrDescFromAddress(vout.ScriptPubKey.Addresses[0]) + if err != nil { + t.Errorf("getAddrDescFromAddress() error = %v, vout = %d", err, n) + return + } + if !bytes.Equal(got1, got2) { + t.Errorf("Address descriptors mismatch: got1 = %v, got2 = %v", got1, got2) + } + } + }) + } +} + +func TestPackTx(t *testing.T) { + type args struct { + tx bchain.Tx + height uint32 + blockTime int64 + parser *KotoParser + } + tests := []struct { + name string + args args + want string + wantErr bool + }{ + { + name: "koto-1", + args: args{ + tx: testTx1, + height: 200016, + blockTime: 1525189571, + parser: NewKotoParser(GetChainParams("main"), &btc.Configuration{}), + }, + want: testTxPacked1, + wantErr: false, + }, + { + name: "koto-2", + args: args{ + tx: testTx2, + height: 200020, + blockTime: 1525189759, + parser: NewKotoParser(GetChainParams("main"), &btc.Configuration{}), + }, + want: testTxPacked2, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := tt.args.parser.PackTx(&tt.args.tx, tt.args.height, tt.args.blockTime) + if (err != nil) != tt.wantErr { + t.Errorf("packTx() error = %v, wantErr %v", err, tt.wantErr) + return + } + h := hex.EncodeToString(got) + if !reflect.DeepEqual(h, tt.want) { + t.Errorf("packTx() = %v, want %v", h, tt.want) + } + }) + } +} + +func TestUnpackTx(t *testing.T) { + type args struct { + packedTx string + parser *KotoParser + } + tests := []struct { + name string + args args + want *bchain.Tx + want1 uint32 + wantErr bool + }{ + { + name: "koto-1", + args: args{ + packedTx: testTxPacked1, + parser: NewKotoParser(GetChainParams("main"), &btc.Configuration{}), + }, + want: &testTx1, + want1: 200016, + wantErr: false, + }, + { + name: "koto-2", + args: args{ + packedTx: testTxPacked2, + parser: NewKotoParser(GetChainParams("main"), &btc.Configuration{}), + }, + want: &testTx2, + want1: 200020, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + b, _ := hex.DecodeString(tt.args.packedTx) + got, got1, err := tt.args.parser.UnpackTx(b) + if (err != nil) != tt.wantErr { + t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("unpackTx() got = %v, want %v", got, tt.want) + } + if got1 != tt.want1 { + t.Errorf("unpackTx() got1 = %v, want %v", got1, tt.want1) + } + }) + } +} diff --git a/bchain/coins/koto/kotorpc.go b/bchain/coins/koto/kotorpc.go new file mode 100644 index 0000000000..7bb3586804 --- /dev/null +++ b/bchain/coins/koto/kotorpc.go @@ -0,0 +1,112 @@ +package koto + +import ( + "blockbook/bchain" + "blockbook/bchain/coins/btc" + "encoding/json" + + "github.com/golang/glog" + "github.com/juju/errors" +) + +type KotoRPC struct { + *btc.BitcoinRPC +} + +func NewKotoRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + b, err := btc.NewBitcoinRPC(config, pushHandler) + if err != nil { + return nil, err + } + z := &KotoRPC{ + BitcoinRPC: b.(*btc.BitcoinRPC), + } + z.RPCMarshaler = btc.JSONMarshalerV1{} + z.ChainConfig.SupportsEstimateSmartFee = false + return z, nil +} + +// Initialize initializes KotoRPC instance. +func (z *KotoRPC) Initialize() error { + chainName, err := z.GetChainInfoAndInitializeMempool(z) + if err != nil { + return err + } + + params := GetChainParams(chainName) + + z.Parser = NewKotoParser(params, z.ChainConfig) + + // parameters for getInfo request + if params.Net == MainnetMagic { + z.Testnet = false + z.Network = "livenet" + } else { + z.Testnet = true + z.Network = "testnet" + } + + glog.Info("rpc: block chain ", params.Name) + + return nil +} + +// GetBlock returns block with given hash. +func (z *KotoRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { + var err error + if hash == "" && height > 0 { + hash, err = z.GetBlockHash(height) + if err != nil { + return nil, err + } + } + + glog.V(1).Info("rpc: getblock (verbosity=1) ", hash) + + res := btc.ResGetBlockThin{} + req := btc.CmdGetBlock{Method: "getblock"} + req.Params.BlockHash = hash + req.Params.Verbosity = 1 + err = z.Call(&req, &res) + + if err != nil { + return nil, errors.Annotatef(err, "hash %v", hash) + } + if res.Error != nil { + return nil, errors.Annotatef(res.Error, "hash %v", hash) + } + + txs := make([]bchain.Tx, 0, len(res.Result.Txids)) + for _, txid := range res.Result.Txids { + tx, err := z.GetTransaction(txid) + if err != nil { + if err == bchain.ErrTxNotFound { + glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err) + continue + } + return nil, err + } + txs = append(txs, *tx) + } + block := &bchain.Block{ + BlockHeader: res.Result.BlockHeader, + Txs: txs, + } + return block, nil +} + +// GetTransactionForMempool returns a transaction by the transaction ID. +// It could be optimized for mempool, i.e. without block time and confirmations +func (z *KotoRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) { + return z.GetTransaction(txid) +} + +// GetMempoolEntry returns mempool data for given transaction +func (z *KotoRPC) GetMempoolEntry(txid string) (*bchain.MempoolEntry, error) { + return nil, errors.New("GetMempoolEntry: not implemented") +} + +func isErrBlockNotFound(err *bchain.RPCError) bool { + return err.Message == "Block not found" || + err.Message == "Block height out of range" +} diff --git a/build/docker/deb/gpg-keys/koto-releases.asc b/build/docker/deb/gpg-keys/koto-releases.asc new file mode 100644 index 0000000000..2274931f87 --- /dev/null +++ b/build/docker/deb/gpg-keys/koto-releases.asc @@ -0,0 +1,28 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: SKS 1.1.6 +Comment: Hostname: pgp.mit.edu + +mQENBFtpTHcBCAC7d7sDUQYKMUL9upUh/R/y+LAXWPOI3Ft6CyGaGWoRu5B0nBmk2dLAYaIo +lIt3GGnkk1QC4l6iDnCfGQmXBnhxkCAwCahBuRo80rP455AYo77B8MczjDW5VOJiTVpuZFOT +79/ssuG+4icoRoDEpljHXo4ba7c9oXPO4VJgluocyVbhwYK0QmU2nAA9J25YW9cOSVOaBjY/ +GqF8vQ3E8FJrFug9KeZMS839RAYTwQKxFSchhs2a8WDL/MMvWeqJxtN7mncvwIFY2ngJFTv3 +u7diUVRV/KplO8ZFFO0VvPFjiBoiZoM6fs0QLxwx6w58oYeoEruhV7/HkHQKWzbkZWyXABEB +AAG0FFdPMDFfIDx3b0Brby10by5vcmc+iQE3BBMBCAAhBQJbaUx3AhsDBQsJCAcCBhUICQoL +AgQWAgMBAh4BAheAAAoJEP0Eu/rQCv3eoSkIALrxH7HdYzYRVb2UwJM9HUWwt6IMHVdmskfQ +VDn6/862GGVm1Cvobw9xLzbcktgt1L0Xn9Suc4Ryo2UjvXZwmp8ThjXYbg1v/UgCQ/eTTGCG +9w1jnZ6GkqJfmdpexB2SWBPzFg9cHGHdA0lVL3hLQY19j3n/EjpxyxS3q2BIwhM+jwgJJDZ5 +4QhivpLQaJuCc1wFhFAfyz2YaElhVC4HLH1ZToUYF/1FffCwW/3L3x4KjnPEQ9cAmrjuA3kU +/xVTlDE/diiVxjBoolNgZ3BC26UCIjWz+ZxZaxSkdZ5uZKjCnrSFx+14CzsNNOMgDQ6wy6fF +inMwvsx+yr9VuqjGCzu5AQ0EW2lMdwEIAKH/xn9bOnZvd8dhnnDnLdHeB5HoXqQK1dN0xo5+ +mt6SN1k/EzgccXYtnxI5Hjn/esEnVyyV0JPIcuj4Do+xj2VL3onW3Qn8tvWLLv69VLaFV7zx +D0dCoThcOgceLsWHnuItJxrNgX6dDfqlJcN3rGujQ9biMhXnCKD0XPntkE8ESWoxPd4At9rc +K0aDAbUPMJ1uPA6tzZKYQVbavqFdcY3LPxO8dJyJCcpGMv3/hqupnjzTEheiiLHwZE57dgfG +cXi5udoNMdLjEHEhx5ovUwCc+QaUeJjdA1dnl1Onee1rWjeE8IohD/DdstF5I2KdGLfg5+pL +baOrqLhPYd5Ry9cAEQEAAYkBHwQYAQgACQUCW2lMdwIbDAAKCRD9BLv60Ar93kILCAC4gEc7 +y1NAoABxiBRuydtjMabeUk5NmiysCz+qokCcbB1TWUPzCYPHwGcC9Ie1ShN2ZPfQsi1D45pq +yAb4ryxBL7bKqa2vTMzgH1zxu6fz5dlLLNWJUR0jMACEIdUAiS2eB0Y3thES1QXdN7vFSG7P +XsTFM7+CGZa6m7NB2qHXd1WuehQc5BJGcuvsMP9Oke4kJtY3q1h/vBnMvUmbTnZQzZluIDko +jzA02kcsifoGLyjkoZCY4VwfW1I5TCycD51rCvAE4LfXc6jjx8fbI4bMYQWMSB4m1JKPYdJE +VyYjeZsRVLdwtsczwud/+f7tSudUDRVLilNwBL4oJIc1iFb4 +=7vTK +-----END PGP PUBLIC KEY BLOCK----- diff --git a/configs/coins/koto.json b/configs/coins/koto.json new file mode 100644 index 0000000000..c1581e523e --- /dev/null +++ b/configs/coins/koto.json @@ -0,0 +1,67 @@ +{ + "coin": { + "name": "Koto", + "shortcut": "KOTO", + "label": "Koto", + "alias": "koto" + }, + "ports": { + "backend_rpc": 8051, + "backend_message_queue": 38351, + "blockbook_internal": 9051, + "blockbook_public": 9151 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-koto", + "package_revision": "satoshilabs-1", + "system_user": "koto", + "version": "2.0.2", + "binary_url": "https://github.com/KotoDevelopers/koto/releases/download/v2.0.2/koto-2.0.2-linux64-staticstdc++.tar.gz", + "verification_type": "gpg", + "verification_source": "https://github.com/KotoDevelopers/koto/releases/download/v2.0.2/koto-2.0.2-linux64-staticstdc++.tar.gz.asc", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": [ + "bin/koto-qt" + ], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/kotod -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/koto-fetch-params", + "service_type": "forking", + "service_additional_params_template": "Environment=\"HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend\"", + "protect_memory": false, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "addnode": [ + "dnsseed.ko-to.org" + ] + } + }, + "blockbook": { + "package_name": "blockbook-koto", + "system_user": "blockbook-koto", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 4, + "mempool_sub_workers": 8, + "block_addresses_to_keep": 300, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "WO", + "package_maintainer_email": "wo@kotocoin.info" + } +} diff --git a/configs/coins/koto_testnet.json b/configs/coins/koto_testnet.json new file mode 100644 index 0000000000..8a2d4ba3e9 --- /dev/null +++ b/configs/coins/koto_testnet.json @@ -0,0 +1,67 @@ +{ + "coin": { + "name": "Koto Testnet", + "shortcut": "TOKO", + "label": "Koto Testnet", + "alias": "koto_testnet" + }, + "ports": { + "backend_rpc": 18051, + "backend_message_queue": 48351, + "blockbook_internal": 19051, + "blockbook_public": 19151 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-koto-testnet", + "package_revision": "satoshilabs-1", + "system_user": "koto", + "version": "2.0.2", + "binary_url": "https://github.com/KotoDevelopers/koto/releases/download/v2.0.2/koto-2.0.2-linux64-staticstdc++.tar.gz", + "verification_type": "gpg", + "verification_source": "https://github.com/KotoDevelopers/koto/releases/download/v2.0.2/koto-2.0.2-linux64-staticstdc++.tar.gz.asc", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": [ + "bin/koto-qt" + ], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/kotod -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", + "postinst_script_template": "HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/koto-fetch-params --testnet", + "service_type": "forking", + "service_additional_params_template": "Environment=\"HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend\"", + "protect_memory": false, + "mainnet": false, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "addnode": [ + "testnet.ko-to.org" + ] + } + }, + "blockbook": { + "package_name": "blockbook-koto-testnet", + "system_user": "blockbook-koto", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 4, + "mempool_sub_workers": 8, + "block_addresses_to_keep": 300, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "WO", + "package_maintainer_email": "wo@kotocoin.info" + } +} diff --git a/docs/ports.md b/docs/ports.md index 751e946e3d..aae5e42e6e 100644 --- a/docs/ports.md +++ b/docs/ports.md @@ -23,6 +23,7 @@ | Fujicoin | 9048 | 9148 | 8048 | 38348 | | PIVX | 9049 | 9149 | 8049 | 38349 | | Zcoin | 9050 | 9150 | 8050 | 38350 | +| Koto | 9051 | 9151 | 8051 | 38351 | | Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 | | Bitcoin Cash Testnet | 19031 | 19131 | 18031 | 48331 | | Zcash Testnet | 19032 | 19132 | 18032 | 48332 | diff --git a/tests/rpc/testdata/koto.json b/tests/rpc/testdata/koto.json new file mode 100644 index 0000000000..77b8ab2d15 --- /dev/null +++ b/tests/rpc/testdata/koto.json @@ -0,0 +1,135 @@ +{ + "blockHeight": 400001, + "blockHash": "e39de41681e45614dae6d24c7c2a3b91f183170255377eef9b3efc4056a6d51d", + "blockTime": 1537241753, + "blockTxs": [ + "4b8a6f4222f8c5989650b2325f52b0bd95a949bdfad21364297ffeb745ec18bc", + "30b10190dc78c8bf6a5fbdf051da76f9d1f52b3e9728f59520156cabb53fff03", + "9f3e4d5dd1c9ff29f5fc33cd4eae4361286d613a135cdf7502be836f7d15f2bb", + "a0e61612250c0d398227d4ef40882517a5430b4a61035927a30466187c35d584", + "263c93a64ddb4b7d28c5325e9bb99240bc39cd06feed3b5ec683700de93b62eb", + "0e4c3dfba2c1da4cd915486ad146f22b78c889dee1cc54ff455e4bb368b70e2b" + ], + "txDetails": { + "9f3e4d5dd1c9ff29f5fc33cd4eae4361286d613a135cdf7502be836f7d15f2bb": { + "hex": "0300008070d9e702028dac3dd18afc4a7b987e41e75fe8d3cee2c33c9acea0f079b19e517c0206b5bb070000006b483045022100b5f1dab66eec7ea3fee1344f353a9a3860a472137828e66d629fef093ed40ec102204249772ef83d48d54e79db42c9c3f96968fb287e78e610935d8f5e84bd5df5de012103eb81a02cf6b514286a29c9b13f95bc65e135940c7aa4bf0e5535573f64e3d2f2feffffff38d3fe7d919cc206eb8ea8bba7f46c1efe2fd08573ff5f2fb7f0efb52fdcd8c4020000006a47304402205fb4e11d1b522566bf2a428030aa989128f2cbd9aeb608402922093a5f01cc3a02207e98acb3930f8970a225a657bb500fae3945d216f5e8775804c931fa3bbcd30c0121034d68df7ac2da467d6480aeddfe076315ba3fdafc4e568c6714fb301f4ee5a033feffffff096d658549000000001976a914cfee27bf568398a2d09ae04251079539f639d7f388ac2437e43f000000001976a91428571e957ed3656db8253daabf670215cebfdf4788aca332873c000000001976a9143ba65fa42bac98797efa0f6c93152c23b7cb08af88ac216adc48000000001976a9144f3bef9a5208ea46030beb6fa9b90e4e939b8eaa88ac50bcf83c000000001976a914a2544801b722f4b8cceb7ca2b98865a13cb3207b88acce783f45000000001976a9149aa1f7f2a3f00fe48212e9e5bce46b4b0717778f88ac43a23c41000000001976a9143c9afdf3ac0992a34ebf75070462a3e437badc1688ace5c96d3e000000001976a914b732115e4c34cc3fae2ab1f11ee44b818a088b9388aca472235a000000001976a9142f899651606c3e6d2911e75590d4779cbe6c1d1c88ac6c1a0600941a060000", + "txid": "9f3e4d5dd1c9ff29f5fc33cd4eae4361286d613a135cdf7502be836f7d15f2bb", + "blocktime":1537241753, + "time": 1537241753, + "locktime": 399980, + "version": 3, + "vin": [ + { + "txid": "bbb506027c519eb179f0a0ce9a3cc3e2ced3e85fe7417e987b4afc8ad13dac8d", + "vout": 7, + "sequence": 4294967294, + "scriptSig": { + "hex": "483045022100b5f1dab66eec7ea3fee1344f353a9a3860a472137828e66d629fef093ed40ec102204249772ef83d48d54e79db42c9c3f96968fb287e78e610935d8f5e84bd5df5de012103eb81a02cf6b514286a29c9b13f95bc65e135940c7aa4bf0e5535573f64e3d2f2" + } + }, + { + "txid": "c4d8dc2fb5eff0b72f5fff7385d02ffe1e6cf4a7bba88eeb06c29c917dfed338", + "vout": 2, + "sequence": 4294967294, + "scriptSig": { + "hex": "47304402205fb4e11d1b522566bf2a428030aa989128f2cbd9aeb608402922093a5f01cc3a02207e98acb3930f8970a225a657bb500fae3945d216f5e8775804c931fa3bbcd30c0121034d68df7ac2da467d6480aeddfe076315ba3fdafc4e568c6714fb301f4ee5a033" + } + } + ], + "vout": [ + { + "value": 12.33479021, + "n": 0, + "scriptPubKey": { + "hex": "76a914cfee27bf568398a2d09ae04251079539f639d7f388ac", + "addresses": ["k1Gnxv3zSegUj9TVxBqu1EpcuiBNFjgvhA2"] + } + }, + { + "value": 10.71920932, + "n": 1, + "scriptPubKey": { + "hex": "76a91428571e957ed3656db8253daabf670215cebfdf4788ac", + "addresses": ["k11Wq8sAUk2R3KTYVFDAGjkj6un5YPsyTVX"] + } + }, + { + "value": 10.15493283, + "n": 2, + "scriptPubKey": { + "hex": "76a9143ba65fa42bac98797efa0f6c93152c23b7cb08af88ac", + "addresses": ["k13GvvBdBCDGRHRY7rwRM5JPNGap27gAHaC"] + } + }, + { + "value": 12.22404641, + "n": 3, + "scriptPubKey": { + "hex": "76a9144f3bef9a5208ea46030beb6fa9b90e4e939b8eaa88ac", + "addresses": ["k154Uvbvk4ajTHY1U7oL2TQMRupqxNWPsd3"] + } + }, + { + "value": 10.22934096, + "n": 4, + "scriptPubKey": { + "hex": "76a914a2544801b722f4b8cceb7ca2b98865a13cb3207b88ac", + "addresses": ["k1CdrB4tpn2vF6ER8oC3J1MYqX7VVpNHDdE"] + } + }, + { + "value": 11.61787598, + "n": 5, + "scriptPubKey": { + "hex": "76a9149aa1f7f2a3f00fe48212e9e5bce46b4b0717778f88ac", + "addresses": ["k1Bw9qLeAXciUojpj9eHQz3ed2kJ3aJjSGP"] + } + }, + { + "value": 10.94492739, + "n": 6, + "scriptPubKey": { + "hex": "76a9143c9afdf3ac0992a34ebf75070462a3e437badc1688ac", + "addresses": ["k13MyxZvS3xGNEAmJeJCD1dCmu4dLcHfYYC"] + } + }, + { + "value": 10.47382501, + "n": 7, + "scriptPubKey": { + "hex": "76a914b732115e4c34cc3fae2ab1f11ee44b818a088b9388ac", + "addresses": ["k1EYBNuURXhmC5D7z8L8YDgfKUj3xVhamGZ"] + } + }, + { + "value": 15.12272548, + "n": 8, + "scriptPubKey": { + "hex": "76a9142f899651606c3e6d2911e75590d4779cbe6c1d1c88ac", + "addresses": ["k12AtKmQqJmV7Y3N3XoJCoTtqNbb334pH3o"] + } + } + ] + }, + "0e4c3dfba2c1da4cd915486ad146f22b78c889dee1cc54ff455e4bb368b70e2b": { + "hex": "0300008070d9e7020001053e6c78040000001976a914536259bf0057233c3ff7116be0246b6f87a000cc88ac00000000901a060001000000000000000015656c780400000011add50011767d2d388e7a4f4faa8400991a71b3374d857209a1a5e2c2f0b96ba6884acfa94c570f8b475e0ecb03e79ee281516a19953a46039fd933c5842d57895b8f668d94b71597649874dba3453c0c86f0984d2216cca501c7b7a2c68ad0d5e4d2c70c422f55496641221f00d7f6806e8ba46040ac0c3bd3f950049ba65d893c57ca27ad7d54663cda4e5d1f1333e6915841e0c1310ed8247bd9481c770dc9956926e11e88a5327fb0f4ae5d6e2040ce8ced0b8cb055e548f12ffb3ec50138d688819652413d3cbb5f2750937955b5fe6f572fd3f7bc7aaeec5fd682838e4c48dec6645dccd6c875f732184adefa74d4c869d1f325c304113f92ee4e0cc6a68e06b43cc9bef9afb7c7eb309f61ae4d9a7ab039c824af0d1cb382a8faf3ab0204dce8376bc7ccb247b9c024d4e0fc4252729198b13f9d340de6b03bcbfdc9e7031e5d0330c4cb32c2ae4380ed05d7b5c38a1c51a2a249348584bf7f2f43c7dace0b06fffbcca780f218ecd02bf799232ce60bb67694d8d7507bc7aa57f872eb1f24da5932df7ccb5bb355c596ff7302063a1918d698c5690469a32938bc2c7b975b021e2f5498f928683be563cb5b1ee53f33d0e8a4ff4566614fe305379ad2a90451022f32a7353c12db86c286b839b07e521fdba78479d4ff4b2992e3f5aeb9f07aaa020e601f93d69fa2af6b72165505b4f620d5e53dc64f600cc61f9fd7f78d106747032aab2fddef12a3a223f51cab9b5c145b4655f99af6674b9cf8ad1c61cbc4662002197e847a1d045fd0d309a7852d64b24776bbbf3d0f28f12e9a22a38c10970c92f120d3dd75e872410e95ccfd3f689248cc0311884df7882f0baac72c45111b0905827f5f4d8b156a04bdd725c54b5f742602b8eac4c6beb2c59fcefcf70cb2167c6ec4069a7d98910dec0ccba55e2c40705dfb8ef0131b601581108c808b20fed4feec165756d5485d72e67b13fb53b07559a855ab8a4b0fb053c530a4cdd9e04ca0cdc974f8a15ac46234663a8dac80cc582522f3421b5c04a8c74f696cb67493352daa7f314fc157e1165066ba0a0a68180b8174641a896e8a389af813ceab7a74653457b145c40c5de457ce065032f58763e65dfbb8806908001ba29a35c4eac8002f93761744fd59d85f0fd8d0f5dd0bde61e385f012a9572217fdfe34572f35b297c149927a79db9270978356f02d26ab0bab17677c458b42379ac1b74efa24d378414b710a1b3e5022d5ff19009c3a7aef6fa5f5dbd1a51da71618b63c5d5d96505ddd03f9f62d645a1ea612eea50dc37bffb1dd6355bc3596001f670efb8182018e36e8d166e2e637343516bb6820ab801c2578de51355f8c9da6bade2511349cbadb4aea27d75eaaed02d0aa2e54ee621aa2e93a1142167061e85e1c4627fbb25b6856aac81093e106143f6dee08b3d621a39ad49e581a7efd6c366c618f891c3e291f26e0151b73fec16c67526578c6b9f5a294cfc8dac6b5cd7b98e5a73f16ef84e3a31967f5281586816bc44a2a2f67c5fa62b4dba15ceea205aeb9e40dc613f39ca4221ed6d5530f3fce0d1b1122f7ec9bf86e97b3e8b92e6198fee7e68844acc003e183c68dff96619214976a61138b8fc8ec16882c1f8b187d96ee7c75758836fe4de4a1b1a383238ba271f75374c924707647844c4c287a5246ba62e149ef56ff93f6fed021a101678e265b7ac4c542aff8159703b3d94b00f647a0492edfd431532541f2f8e4f618f1c34977903b60ff9bbfc1b27dd09090eac211620256899ca8d5b94bf6ad3844f7a86d2cff2116fb1eb6cc59b12f447eeb9be0f370602b20824d16ae4f9d4fc3d92bdc6a0dcab8764a4896bc7fc9edf7a793606ff66e756f1f5bf63c97324eb09a07903a0545cdec3709e93e0438e0af1b80842a23e314e98aad7015ac835d458878d6844b9e2fc532db99f8d2640107959f3d994a35be311c6a9ca3dc6838d6b93372b6de8b34663318b00261264c0c8bd5ea949a1923505adc2203e062fd0922c3b6232678ec6a4bc5b623021658ca516f071157165ba0946bbc9e3e3507633d9ec72f8132c3c1cd9d78894b781a4a97764497fd7d535951d9681548a6a9aabcd768944f42d7b4891a25ac6cafde6366f3c37fa88f3fb2e4d6dd6c1a3dbe474261af076bef57d51c5e5159a72cb7ae1c308e5c0405a6a102b152b97da70413b04dd6adbed9c28b5acad1455484203452aba354f99cec57e8aefb432ee631a3c90719c31b17f88039193cc983ea37289f66977f975df0370ca8df54ead80562476592152c40494538974dc354b13a298872c5dc61910660321b4e0b08fd214abb051a8df8594cec54a2e247a631932240ea1e42ed7969a85bd0a171f0276c677a58d3a849fa8bd687334e90af7b37c5cded83daf8fa48b13f7fb718d31859a40aa1e60e22f4794879c0e806c47a41ed943b0bc70f451b1c256938e5f3e8e36b0262f93331d813b7c41b31b75b592efc6d7923c536a75ffd8ac5c7f9f3ce2d1f77932fd9e6941acd1a37eb89556dfb75bfa5abd5dfc4483fd42e552d87afa0b961e87bef3aa42310588b72942fb1b12a52e37bf2af438dfd15621df742b0031f5d530220c690bc66cf6019168737b5fefed474662b8a44414d6c80cd18d527d1ad0a", + "txid": "0e4c3dfba2c1da4cd915486ad146f22b78c889dee1cc54ff455e4bb368b70e2b", + "blocktime": 1537241753, + "time": 1537241753, + "locktime": 0, + "version": 3, + "vin": [ + ], + "vout": [ + { + "value": 192.00228869, + "n": 0, + "scriptPubKey": { + "hex": "76a914536259bf0057233c3ff7116be0246b6f87a000cc88ac", + "addresses": ["k15SReTvjGj9cxnyw5VzjqfXMJX11myKS9G"] + } + } + ] + } + } +} diff --git a/tests/rpc/testdata/koto_testnet.json b/tests/rpc/testdata/koto_testnet.json new file mode 100644 index 0000000000..9c7887cc3e --- /dev/null +++ b/tests/rpc/testdata/koto_testnet.json @@ -0,0 +1,68 @@ +{ + "blockHeight": 250000, + "blockHash": "6d840a09897d54a485d090e6fea84ff88190686e45093d4d6b5557d7818565fb", + "blockTime": 1539169834, + "blockTxs": [ + "ade35f9c49194562bf0c54041b38f2a2f45dddb5e477a98e3c129d35dc9639a7", + "258812b11654737989d6566b026b566288f9b822a6d665505e15128879c880c1", + "a91db9da8eb226b5ae24a41f95c3aba2a7e17eaab9510055b0237c59e266b7cc" + ], + "txDetails": { + "258812b11654737989d6566b026b566288f9b822a6d665505e15128879c880c1": { + "hex": "0300008070d9e702032fe75a1cd3d0cac71114353e24fd4d270702c2311b9e9d8f8f1f4dbdf5ddc8fc000000006a473044022040828b07862d7d0a2ca014ddea7f3cf42a313d1cde828e390566c7b05bb0f8c702203e999f511720280eb5bd0baf0786efd8457127f9abda902d05b0105e137806f3012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2ffffffff73f04bf9ccc77cbfccc1c2afd5a14cecf0e369f98529242f75355e7e7a839d3d000000006b483045022100ed03a956400199c327d24ea4d283bf7503af4360376244ef1a923e2fcafbdcb902200107b8e0a853146cbf3a733af17b2eb231e9f8a4ddf582dbccb49a341356bf70012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2ffffffff91b4b4ec8b60b80ce35c2f5f00b479765d6a3bd97b46467cc3283ae50ac3a080000000006a47304402202943f9fe143887754c6ab61026b72d36be80d776ea68f2b4915483cd8ec396c302203f8396cd9fc574e1227a1a753a8aafef5f8a9a805782fb0cf49d940383bdcfca012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2ffffffff0000000000a4d003000118bf7ec6060000000000000000000000c244cc64acda1a46d9ca98c8b8ce0334e20c0b19e97ab93992c1f08fda48d4533899e9e343d58ce6f7147b84d6932332a9a6db1a352160efde82b54a4d9cbbea5cb07115cf89f140eb0cc85b6753e5e64f3f937916719127cb68e697634f1a264cdc7b19bdd051f8516e562a9ebe5e09e5dbc20aab36d4a42c8aab5950be7fa3a5c908a802350a12b0102d15199118227c1802ccd13526c21b8f96a4ee948794b78c372a62cb81edc5ce72fb02419740611e33c8c51e8b8f95bc1ae5260c733ba1020265be16eae4ab452c1b0fbdb7d11215afc561741f8b2be445dcc49aad33e9e2eb80da860637fecd7aa7171208cae6d2af846e555bbbc84b859686e2489d7c043655667fb7616045233a1f2b9fc2c16866d33e7a19dc6f4771beb2bec1d1022fad4d44b83b1543f9668b5298cce2c8097bc930ae08d69e9c5f9f37e9fc66210222bb675dc00b16fa0c5a53248b4af161fa11c9329335e16ea75b1a704c7abd1a0b00531037d418f03c72c52f2d8ea84390e2e0c592f857aee18aa08e220a9b15ed6a930ec3193708e63bb546d28dd5daa050a34ecf7d99186c34b03f4263d3a001032ae9d83a241704963f0691b544a7726ce9cf6587c3a06e27964e129e51d242d30211770998b9ba6543986c9f1b5a7552969939e295a37964aff64a16fd493d07d9032d42c640e293e0cc7a732a67e33b8d13e722b9660366aee760547ff2897efd8e021dcefcedb7ca9394901a55325e4b2a314fb83132918a8ac1941cf3499361935f0223cbe53a427b89f94faafad6762fead8f57e5310ec18311eab048f3eae28253553f136d5b498e28ea72bbe164d24d24ed1e1d9661d02c63055be7f9108d9cc2a926bc74cc9381ec7c0a8e004f783b462d157d74dfb473d7b055325adbecbd99654f8ab5f7bf490d635dbc4766fe99e0b6b2736dfff81b58a150cf0544a929c441c0669d3337a00f1fc95146ee907f789d3ca89df3910e16fc3526ee6358066ec531e983907b6e1cebe0e8603cbdfcefd3e952726836ef56eed76276493dbc7c3562671e7067dfba96371109445e07b90a56aebb1756ca2e3680ec4e241566881c798b931a4f533e6e56065467239be6723800208bfc90d7e0ad0b353e5c30b883f2bce989accd3bec8dcf0504c9e458de767b5f31660fc631f0b9782faa62893b540517785cf79b59b343795d0352d6168f6593f56a5a7913a938bc11b60babc4269ede64a1fc28882e327a7105edb99e4555ccd267e29217ccaa44078544be83679f569aab6936fba7b9ae935c470a3d58f4b47e34c891baaca48564ffbc466ea39f2d44bcf0103a50a01271477240774fe65821a02e10a139eb7bb1554d23b2c3aac95d1f0a418ab728a764cc118408819a09645650cfbbe7486a05de4310ed0b8bac3e0c0f747c47a28205093d9026a2913abc69a60f6b35d0199023ae4c2bc03afd8a4052781c101322e0d55953289d6a8a5e3dcc797d697c2bb4c076672f751ddb4c9f073c488e683a35ee1b6cad1a60ef2f74a123a28d2f4abc0ae335941d886b9be368454e4bf68eaeecd4e9b051868d7ff8e8fe18f956de6b1fc7da224e870f77439a58379e2c1a7ba23936d77e59083c4e06c96268e9ab6c94d08bbd87482fe09624f79050fa52cbbff62f68fa5a17793d98e845994dc7265fe0a00751f77ff9661091fe3978c9d3f67758da843246c43429ead67b3feca2e6dda5496db54890ac42f66e2ab18f0cef8621e32a322f5a888d5fe913ed21cc63fdeb1ebb4cdcbb0acb92fc3a48bed2f0664799f04cc641556aa2c53bc8c2df70b7a9605206c4d8e83ff5da9aeec0efb294a6cb65656c611874161afc634128d9faf84e828f1388154a114fc6bca5e3f0832a302efeec36856e5dafe6d85d8605878d25c77135f0f43706d70ad853e2fac1cb7a3a2365d8f729aa437dce6b7306cf05056fe2e99c2a7614adc8a58b22b3d6af982601047e423f475e1e8a2544f738c513a9cca1cf43109e882782d3d57eb6cee1fa32dd9532292ac0607c6f3dee0934035fdfcda9b3dd33ad09b55755f6375e18f65bbbe7fc5811b0eb0a8c9809e978104fa7cf6fa73647747709a467df3f7c9b802c8eed451fd39f39b5fb2f087bea982184ec3560306f24c14e3f256a0ed42508e23a3700315d08286fabc52fe6dc92cb4711f0af002320bd925f19ae3fa9051c8fabe37f203094edc7b70bb53455582f8c5241ec4ac151d098c82d6b6975c673cde52261cf6b66e25544901e50ff6d0ddd41f098ed48cece7943f318b7ec227b31f3e018c9a48dc6bfa46e6ad38e6ddb4f8a8cfa0fb9d6131de56e7dd0458793f450e59d50d9f38c44bb59d7cebab6ab2b8c337f09ac42e33b2b63b242dbd5dbadd2db6acc79c951aa20c125144f280a6414d63f8fb28353147432e24367e7008db9772462e743e2743b00f441c8cfc1448abf1097f8839eaf9d8e557735f68ef0f8b2bef2e746a41202144290fbb93832871ff7055774aebbcd098f0421bcfdcf1bd113b243699f06e91b2ae280b62365ba55f92b99b9a69955dcd3f5c3dfda99f9518aea432725cae0315e855f8dda17e5c99b3fb7c46652cc917de8407347e265ff50be3f1a470219160cdfb17116a19dc0fe677756dd8d8403a574a15df07", + "txid": "258812b11654737989d6566b026b566288f9b822a6d665505e15128879c880c1", + "blocktime": 1539169834, + "time": 1539169834, + "locktime": 0, + "version": 3, + "vin": [ + { + "txid": "fcc8ddf5bd4d1f8f8f9d9e1b31c20207274dfd243e351411c7cad0d31c5ae72f", + "vout": 0, + "sequence": 4294967295, + "scriptSig": { + "hex": "473044022040828b07862d7d0a2ca014ddea7f3cf42a313d1cde828e390566c7b05bb0f8c702203e999f511720280eb5bd0baf0786efd8457127f9abda902d05b0105e137806f3012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2" + } + }, + { + "txid": "3d9d837a7e5e35752f242985f969e3f0ec4ca1d5afc2c1ccbf7cc7ccf94bf073", + "vout": 0, + "sequence": 4294967295, + "scriptSig": { + "hex": "483045022100ed03a956400199c327d24ea4d283bf7503af4360376244ef1a923e2fcafbdcb902200107b8e0a853146cbf3a733af17b2eb231e9f8a4ddf582dbccb49a341356bf70012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2" + } + }, + { + "txid": "80a0c30ae53a28c37c46467bd93b6a5d7679b4005f2f5ce30cb8608becb4b491", + "vout": 0, + "sequence": 4294967295, + "scriptSig": { + "hex": "47304402202943f9fe143887754c6ab61026b72d36be80d776ea68f2b4915483cd8ec396c302203f8396cd9fc574e1227a1a753a8aafef5f8a9a805782fb0cf49d940383bdcfca012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2" + } + } + ], + "vout": [ + ] + }, + "a91db9da8eb226b5ae24a41f95c3aba2a7e17eaab9510055b0237c59e266b7cc": { + "hex": "0300008070d9e702000188b91db3010000001976a914d394f4a1396ea65bfd51575928af611b8dce67d988ac00000000a3d0030001000000000000000098e01db301000000c244cc64acda1a46d9ca98c8b8ce0334e20c0b19e97ab93992c1f08fda48d4532ad2d47594fc399ed535e91f545665e63ed114da3218163bc58353db891d76c675e02504403cb21b2fa7da7b2d3c2e2032b67627b094027d43b87024f38a21736ee91ac00360f1ba9cd4050b9e874e8ecfe312c129936ab39242230d4c654dc729d886cbe0a13f6b0e0988c665137649507d7b9fd8017533f7a083619530706a068eb381a5dbd36d1fe44e4ea53d85127b1a7c9128c1fde0521f25ca06774a6a696d0a9c974a3ff4dd63765bd889b1492764702503047f52bb352f4201d1cdaffb299b5002aa4ed4c7db0058de1e683e3847ffcbbb20dcf1ef07c1c5e4a7f251601659ccffd9c5a90a9123d0a5845593b0fd07aef0726079a6018cb0787a9cda020a054c9d3d78cbb722f0f9bf5db5bb7f8ee7a9b8b687f285672fd3bb8bcfd3f7022a5738d1142cb1c2917ec64a42d3003408494eb724013fa1d532a68b3cf846630a09077ab9362a00bb2f578663c404b36ff69f972ece41ff00d89833944e530991214c1d68a6a416992c78353a47062c19f6d35df481a6dacae3b14a83d8bf09e1031019a025578b2db7d9c28e68e2b841d5863bfab1f083a8fe840c3c6a26528fe1032f9cdac9a0d828d0ff03f2467871a0088f5a0a5d5679f059ef341b5b06dfe66d020eb57efa8300e7e579b679f5f2fa4b48cd18ee60369566b393fa911ada9c813303256b4ad4e9ceeecd79e1e29a122051c75ef6a2667414c7ca6f25e001dd190d6203256ee6d796aea38d2b3f6fef9477774d8757cd00d70f0b6b1e87601e57df44027ec75cfd5f45ef602a7d38595885f5bdb4737097dcfdadb18014ae60cb045bc8ffd1bdb8da11d99272ef41d946cf74c3171e3d8dfa1bf93c018da115aba94880511767dfa0dd80d98ca339138c46dd266e02f60bb6c9cd58a95f181bcd8642bcf8b66af7877f7537391cd2b17a04966f1bb0184c81876188b0ca5f404dc57628dd113055becede077f2447a3d1992c6188b19c70fc54139d4cafccd2dd1a17eb08da1b79fcfc5385b449fd655c82f0fab03a6738f28c5245bc18adc9cb8890c690846a952b86cd15345724b4598db731139d03377cf48227a4da584abaabc8976c51a8a090c3018b5595c98e2c25b8d603c07b3127dc886a5a6ee7c3d222664f7ab45b3def34e120da3ced88bb6e5e25546a0b315472bb83475f6acfd39cc9d8bc65d92e3741ba44182df71b8812e64209de28f0a5dd518e16fd8c19f16dfaf211200b5a095c65703dc8209bea66c2c7740a01f6ce65d17fe9f2ae7ee6a009c026fd2397efc865cce6459c10e0acc5f8e143d9a44a7f699f7ba1f4f566f9f1dc1a04a027935466a10364dba97581d6be53c7241490fa87fd22c68549f0b572dc8d697a59a521f8f8be122c1e99b806dce21b04dd13c3089afdd61989304fe6b20c344f59e464dbf9c422b101ff338bcb6fe01c960664adb54f594f4223f129e3f5ea78dc66e351528918aa6c8a27b35f28deea3111d68342a5b29f79aa892ab47458681b24106156e5ed791f7d63d0fac47c28733274d2279416724f38212f3df7eee3902211550030c60e23da64b5cc8257ce3ae98a20aa24f5803979f1b437bdfcc047190295d61bd6fddd39829f7e5faaba94a694c2c29971fdbfae9cb7f1e4362daae9ac8c1a9e3b97c4f29f9d7fb922cd478e6dd3381fc6642809357c66c6718c9ea674db965ac7e84b508af57c70b543ce78baed196a4b916d28833c3e80947dbf0cc0d0efc1c2e896fd84026444819184ffb9e9374171ddf074d0c7b5ff6426f67dae85f960ecd0c53eac28fcb6530e92db95c431ad0efeeb586eafa9fa347e0d0c7084b94be363dd7bf61a6af63692f24118217518bcbcae1e74cbe9375cb6d17691ef9058887e0cb0ea93ce2c390968c0a42292f337ff7fe3b2a03bb25988a56cfc6b4606dc12ce5b602cbf7c7da743b58cfd81d77c0a5bf1548cca9e4b34a5671f611dc9ec41fadec51bdbc06e5a4e8a7bdca6417915b6979236d8ae87786bcb1bd1d25af54aaca0e584de408a39cc2aa4e73f2760496f313b708735cb8c6a1affe23f31a558dab0708dbfcdaec1e2ff557624c53bf1a8dcdea35c8d160c4a593262284c19bd780598ebdbf5498c50a3adb823d6379a0b36b530f6bf6911d8983872e3052a4f1d467457e60d51c20dac0049981ce4774e47fe215d9c96feb2f046cc8a250dce56295b23d16568770872c911e4ea0f8ab3c5b0fe5eb3d8323dfdcf0fcc1fcc7f783f6d1080617ad1a43eca80f45b3e208980e036808c936956e571c327934c6ad37323fe289b8fdd674f0b43bd905d23b0bc57c12c9667093ea2b9401d57342e18f7a3e129383262c6cee5041f54f66edb519d5ace6b6666b68fc6290954daf8e5b89751a14ac48b1ff9a55f94d6ab9b913d68c9fff1d15401904b3d85e90d03cbe5521df7108a958481477ad730162898585e2164094de164cb3a5efa46ca4d1765f26dbb58c28cf43c45cfa1da069124e44846019fcdaca4f45c6b46c8aeb3f70ad0e5b9ea6753fbd36793d8bd9484da17df7d0813c4d3fefd4f149847d40841cfc7113d1b0faca7afe2ae30fa0bd22b85c70ac06217a92294472749022dbe0ffaf35685b903", + "txid": "a91db9da8eb226b5ae24a41f95c3aba2a7e17eaab9510055b0237c59e266b7cc", + "blocktime": 1539169834, + "time": 1539169834, + "locktime": 0, + "version": 3, + "vin": [ + ], + "vout": [ + { + "value": 73.00037000, + "n": 0, + "scriptPubKey": { + "hex": "76a914d394f4a1396ea65bfd51575928af611b8dce67d988ac", + "addresses": ["kmYJd54YsiwaVnPc5mvzCf5QuWB1qSyG8zh"] + } + } + ] + } + } +} diff --git a/tests/sync/testdata/koto.json b/tests/sync/testdata/koto.json new file mode 100644 index 0000000000..d1cf3869b6 --- /dev/null +++ b/tests/sync/testdata/koto.json @@ -0,0 +1,176 @@ +{ + "connectBlocks": { + "syncRanges": [ + {"lower": 425179, "upper": 425199} + ], + "blocks": { + "425199": { + "height": 425199, + "hash": "ce9c118a48879384cac6814c1ff1607eada800cf0fab7332ed75a6b965fe90df", + "noTxs": 2, + "txDetails": [ + { + "hex": "0300008070d9e70203c47db19cb8d0b7a158c646460ea063b2083715f1f5d1db570f28af347aa3dcaf000000006a4730440220072226960f38e00738437f0d6f6b765b1a81b3297b6d74081a2ce180a8f37b9002203c7db66b58f7b32b64fa8c39d07dc6638527b1a1e2c876c179b092df03a1913401210384237a1897ac13990ecb0be4cd969224850e04db8bb04aab135e75b049bffc9dfeffffff7242b45f369affcf2f0511d16e3774658665d217c153d26e8d6fec67192a1701000000006a4730440220345c4a4894d2d76294d2ea0c1b67743981403abfa97dafb821fb2b408479ea9b022035e855a20bc0833c31a49569eb807693bc873ddb70ca7ddff4f6ab0f84c9def601210384237a1897ac13990ecb0be4cd969224850e04db8bb04aab135e75b049bffc9dfeffffffa8a4dea5077800eff3bee9c73717cfdd474b63ea0b7f49e15630d64cad3b9709060000006a473044022010bc2042271982e0543f6c45de822e5939622601835414a86ca270979df1011f02206cea70fe2415934f4cb72fb8bfe78c2df7b3529b5c00b0a91c6e38882e99d8100121029d42d42e9cc9bc8b70cda3b014d3002d209839a511caa617369353325bc02a1bfeffffff0cb352884d000000001976a9142956e29d068e7d611a46205000495f23c9a4551c88acd1833e43000000001976a9148f7eb2e244682eb5f28ca34a39bee63f8ee3ba4888ac196ebe41000000001976a91428571e957ed3656db8253daabf670215cebfdf4788ac6324b14d000000001976a914a6f21e7f95bfd25a7e83b3184ddf858d1c7e8f6788ac6488ae470000000017a914b0b3fce8ef27bf604d830b3ed70f46172a3336da8721b06c02000000001976a914f5a2dcb6f035aa2cf33eaa786ac6ff552c63f05388aca393e13d000000001976a914f298350f4a8ff8cd9b3a3b21f1ad31c485e1e65088ac7406e33c000000001976a9149cf187c0824e833c481a79b17c702a20052e587288acb921ee3b000000001976a91486464d41ef01508a86ea573238f7c6ee6468ae1488ac3641bc4e000000001976a914187be7997b3dd1abfdaf8d567a87db6b2185604e88ac75a11a4b000000001976a914c616d662e4814da16a5d29796a43b7cd0217065588ac6232e746000000001976a914d2c23187c89fceb6ffe581a7f954e213b2874de788ace37c0600027d060000", + "txid": "4b6bdc4d3cd51c1c15d089be41c210e5c39512e524c061f43446369d112736e8", + "version": 3, + "vin": [ + { + "txid": "afdca37a34af280f57dbd1f5f1153708b263a00e4646c658a1b7d0b89cb17dc4", + "vout": 0, + "scriptSig": { + "hex": "4730440220072226960f38e00738437f0d6f6b765b1a81b3297b6d74081a2ce180a8f37b9002203c7db66b58f7b32b64fa8c39d07dc6638527b1a1e2c876c179b092df03a1913401210384237a1897ac13990ecb0be4cd969224850e04db8bb04aab135e75b049bffc9d" + }, + "sequence": 4294967294 + }, + { + "txid": "01172a1967ec6f8d6ed253c117d265866574376ed111052fcfff9a365fb44272", + "vout": 0, + "scriptSig": { + "hex": "4730440220345c4a4894d2d76294d2ea0c1b67743981403abfa97dafb821fb2b408479ea9b022035e855a20bc0833c31a49569eb807693bc873ddb70ca7ddff4f6ab0f84c9def601210384237a1897ac13990ecb0be4cd969224850e04db8bb04aab135e75b049bffc9d" + }, + "sequence": 4294967294 + }, + { + "txid": "09973bad4cd63056e1497f0bea634b47ddcf1737c7e9bef3ef007807a5dea4a8", + "vout": 0, + "scriptSig": { + "hex": "473044022010bc2042271982e0543f6c45de822e5939622601835414a86ca270979df1011f02206cea70fe2415934f4cb72fb8bfe78c2df7b3529b5c00b0a91c6e38882e99d8100121029d42d42e9cc9bc8b70cda3b014d3002d209839a511caa617369353325bc02a1b" + }, + "sequence": 4294967294 + } + ], + "vout": [ + { + "value": 13.00779699, + "n": 0, + "scriptPubKey": { + "hex": "76a9142956e29d068e7d611a46205000495f23c9a4551c88ac" + } + }, + { + "value": 11.28170449, + "n": 1, + "scriptPubKey": { + "hex": "76a9148f7eb2e244682eb5f28ca34a39bee63f8ee3ba4888ac" + } + }, + { + "value": 11.02999065, + "n": 2, + "scriptPubKey": { + "hex": "76a91428571e957ed3656db8253daabf670215cebfdf4788ac" + } + }, + { + "value": 13.03454819, + "n": 3, + "scriptPubKey": { + "hex": "76a914a6f21e7f95bfd25a7e83b3184ddf858d1c7e8f6788ac" + } + }, + { + "value": 12.02620516, + "n": 4, + "scriptPubKey": { + "hex": "a914b0b3fce8ef27bf604d830b3ed70f46172a3336da87" + } + }, + { + "value": 0.40677409, + "n": 5, + "scriptPubKey": { + "hex": "76a914f5a2dcb6f035aa2cf33eaa786ac6ff552c63f05388ac" + } + }, + { + "value": 10.38193571, + "n": 6, + "scriptPubKey": { + "hex": "76a914f298350f4a8ff8cd9b3a3b21f1ad31c485e1e65088ac" + } + }, + { + "value": 10.21511284, + "n": 7, + "scriptPubKey": { + "hex": "76a9149cf187c0824e833c481a79b17c702a20052e587288ac" + } + }, + { + "value": 10.05461945, + "n": 8, + "scriptPubKey": { + "hex": "76a91486464d41ef01508a86ea573238f7c6ee6468ae1488ac" + } + }, + { + "value": 13.20960310, + "n": 9, + "scriptPubKey": { + "hex": "76a914187be7997b3dd1abfdaf8d567a87db6b2185604e88ac" + } + }, + { + "value": 12.60036469, + "n": 10, + "scriptPubKey": { + "hex": "76a914c616d662e4814da16a5d29796a43b7cd0217065588ac" + } + }, + { + "value": 11.89556834, + "n": 11, + "scriptPubKey": { + "hex": "76a914d2c23187c89fceb6ffe581a7f954e213b2874de788ac" + } + } + ], + "time": 1538761583, + "blocktime": 1538761583 + } + ] + } + } + }, + "handleFork": { + "syncRanges": [ + {"lower": 425179, "upper": 425199} + ], + "fakeBlocks": { + "425196": { + "height": 425196, + "hash": "23053ef4d176fdea1c2170359a7c649812f8b539284256c22433e314d265c871" + }, + "425197": { + "height": 425197, + "hash": "f92aa2cc038d4b3aba7c8b5069aeab48eb18d1f3ca35b10b5df7693a739b4776" + }, + "425198": { + "height": 425198, + "hash": "eaf812da43d09105255f62d6376025e0b8d0e1163bfc85dbdbf1dc9bd7ac2bda" + }, + "425199": { + "height": 425199, + "hash": "3135d38e93e43f4d26f51f5d0d3895f7f9970347ae63d27b7312251a1ba1da9d" + } + }, + "realBlocks": { + "425196": { + "height": 425196, + "hash": "a3e74c903714ed174f571f4428f096e2cee23d4c28dc8036bf3eea5fe9cc2b2b" + }, + "425197": { + "height": 425197, + "hash": "4222ccf00d121f98ecde9ddc3d7dac9bfc878764ad51b35100c61fb715ee5c22" + }, + "425198": { + "height": 425198, + "hash": "cbb952469bd1631991ed1a7c7258bc31448fa1c7e3f4f5be6f148bdfe7418fbf" + }, + "425199": { + "height": 425199, + "hash": "ce9c118a48879384cac6814c1ff1607eada800cf0fab7332ed75a6b965fe90df" + } + } + } +} diff --git a/tests/sync/testdata/koto_testnet.json b/tests/sync/testdata/koto_testnet.json new file mode 100644 index 0000000000..0dfe9bd6f6 --- /dev/null +++ b/tests/sync/testdata/koto_testnet.json @@ -0,0 +1,84 @@ +{ + "connectBlocks": { + "syncRanges": [ + {"lower": 269167, "upper": 269187} + ], + "blocks": { + "269168": { + "height": 269168, + "hash": "81c6ce92cded9566f17f97e5fbf1a0f92d8e7e245a24fed7ae3238f7958c3065", + "noTxs": 2, + "txDetails": [ + { + "hex": "0300008070d9e7020222280585cefc141d14b2722d405d17e686f2df01bfa118c13a201cf195bdd5b3000000006a473044022005e8596ee6b22d9ca0d980d9bdbb2336b62abe6756435f8e30c99ac848b89b8002206e38aca2e5b181ab2df280251ce9a72495f7df88608facd2ec9e8fcf12692b52012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2ffffffff6fefc6ee0fae69a650cc795cb3bf83a7d71d95b74e7bd66111e9d80c12e1d9b6000000006b483045022100ca0dc03ce941e6f78797a57887e61b7179d81378bf7644aa40d0ad1921d7379a02204b758d1cd8466e6cb1e7aa38658a0ca7deb6b76072a98042e1ba1adecbb2806d012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2ffffffff0000000000831b040001f05a5484040000000000000000000000e275ddbbcb41dc5b58dda3f9ccd6f89cb887ea7caf338f7380f0c558adfa4102e983e4506b5d20a67b1c882b61c671d7eec38c4edb74a62aa5228f2d8d632295a57822f7d8960fa4e5674842dbc6cb6a3621cd4dd087c03df1ea2fa5f4a69f128b09d36c9702e8b80faed69922a4de5679f34ef2bba6937f1bb9bc1ba10ab32cc8b55c49a3ce86b9286c6b93cff1163a3d3abba699f59033afe682a561e924d4e375cdd8071b66ae427acb7c3a00182b1a1a4e3d767f42e8b98ab30d24c1786eaabc9b83305167b0d41c702dca8866f8763699d85a36c061f721b79418628adb8378e1551db0b54ad658f4dc6a06793b38ad8bd463412d70a480db2285aa6de8b60718c87f2c7f6617e5c419c1f1625665574b4f5214f67147643f992c54d9e6022073ae6e313c77eea5bd1302c861c8f93cabfda6cb3ca3ab5817839e90c81699021ddcb3045ff0a36e426ad2fcfe02b6e785640d4b2b39e3733edd1f325931f3940a06ccd97c2374ada6dd5035af41a55a236e2f9aa180a7210ee147a818bed742f397259ff5abdbd53bf0655c806b6cbc400f28e538186434c6f4648d78c341a007032d92cc5844714f52aff3f66e678da3fc1ef3170a9d4353c6341ad3e6273d37d802142c3548c5c83eba678de48539039c8120a8826f5ef54bb362689578f264653f03082c7b53f085308cec7f18c36efeebd1c4f7fcdbbac85cc3836bca30073b0d570302c3f00bcd123866c1dc9ede0f236f0027f75891ca636aef5211a5e10a429bcd0324450f008b4f7349a74015fadafa7c64b9027b00070411f794ae65bdff875367934f09d2560c2f2e03bf5a603a204eb7ad81b2aa5f2814a8a9c95ed463161886f29530e3d6cd6216dd5d2bb43e09a0bd39f4fba983c79e634799fa011fd31a97ca5d3cb2fa3bb78482177981d9b436dba02289a95aaf5a493072abfa7d32c3692b9d089ce3687830d96ac9d0d0d8be53b2a0977fddb735d18c9bb8d737adc985c461c5f71afb8056c5384b462c1681118879bd0ecad73431e416139701556a3971a456573bf3cb1c1b36fd4c67794dbbbe138d3a25ab97c2b51017b8499d6bcda46c9fc6b61ab6f4b23280ad635f312e2dafe90b7598fcc047917d08b05b3b8c27b848fe7c687777f276d51ace9a5df3852cb1961aa3c1b8fd6a238bc8394df9355d8b3cbda54785b98eec499cd1f817fec6c0c6556f6c4475ae1bcb664d1d2f8eaf4c6ec8ebec1d227b1be796d3f6e5345acc0cc7651b8d16064c066c2db97388f6a44955bd7f15ae78f3c46dad07f66048b0ee8601f64af5733d79b7bd8e7f043338bf3a94a6d0c3f2ae3345050b2a33fcb15bce7cffa2e9b728c12e02c0baddb114cd826ca89bc71d78f14ae3f6d2e0c5d72c998efb92e86fed5f50760a723b275dc44e9e35e15c23363c73bc9c7a18eb4004a7850c9cfcaf670eeae3ce04fc882654686831977c5c5ad9755480b88abb1fea1296c8ab91931c10134155aabcab63e55e830b9710f166f6d40fca76a3367223237352017067b005c0af31eabc2d0949b655a50195a5968a170198ff69ce462edc32a79d82b9df44ab56b260aae5cb12774328c6aa4395369966a181288cb731b26792a5377356ac31f5001c26503b811d63960d1be204da1e5687f46aa786be9987ab52047695e3e4a0e8a7feac0f215c72b76015a25ee77806cb48810c4d1762ccc2b8142ce56c0337e67e7d89084aa2ba56f124c07c79b9465210cc74255d3107a14bc8af353127ad6fdbbb4f73eec790127141c5696d6b5a030678359b24a62ac0dc8cf0dbc1b4607b2f0fc14c2673256b6518a9e01d7cf4cb4d5b58e0e64c874d2a2d91a9378f2630b21583b2600a04733799c2a30266698390f29ae4f43ee9461c2f5f0288ec7a9ddeb22b02cf5367526bdd901d8d4a5f171929d3900025ff3e4b57deeff44d0dafb6818207e9191ebb4de1e4cca118676d1affd7b659c732518604974286fd1181cea87a1eb65d72d027154b75841648668ae064611b7b5236e1b76b3b878eb0374e62f8dcee336ecb8dc2a3747102a164af526e69eed232af764c6891ad39f0889f3c8532f89089b9ce212ebbfd42c3320b0d139006edd6edd9bc442586475c539a686cd36532cb626bf692eee64162571c6e1a3b32c976fa919fe0a45fda0717f660d4adc86e2fbbba4fb9495ac19f78fc845757f7d0a8fc45a7469f189003a87d9ad45d8cbf172758c34a12c90a8634b44a344a6b7478fae2ec52e4c41a756286ad31ec58b8942c64e2ca9abca30e7cd6c91f7c7fa40dcf066fa89ff647baa5835461cbbc4e1fb183d833f6e213a7a829588ffc21c55aa02151367944f6c04a8b43844e402e92cb6e95e134f1078dee7dff242a6a38a5c668f21ae4de3cc678e1c49c7107621ea89c02e476a6b95038a675616e5768fc611761d4fc8a71641faa45cd50e7518f5b456969d01b2fa86aeb5a3b6ec41249c1c97d92c46c1e1f8125ca47fb5cbd2a15215b7e3adfb9b870fece53711a99d635ecb6ebf04f56ebefe050600fefffb57b081a327813e1595b7fe2426929274f4c4cd5b6868267e4d32314df19dc84e7cbb63c795292c3db207611959e4c14523bf315e666e54b3d15b40e70a49c72966dc6a2eb77f37edd69da8300", + "txid": "ed6dd088d9441381e625fbf38afdf34b91c004823851d38e686f7ba9e05ce41e", + "version": 3, + "vin": [ + { + "txid": "b3d5bd95f11c203ac118a1bf01dff286e6175d402d72b2141d14fcce85052822", + "vout": 0, + "scriptSig": { + "hex": "473044022005e8596ee6b22d9ca0d980d9bdbb2336b62abe6756435f8e30c99ac848b89b8002206e38aca2e5b181ab2df280251ce9a72495f7df88608facd2ec9e8fcf12692b52012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2" + }, + "sequence": 4294967295 + }, + { + "txid": "b6d9e1120cd8e91161d67b4eb7951dd7a783bfb35c79cc50a669ae0feec6ef6f", + "vout": 0, + "scriptSig": { + "hex": "483045022100ca0dc03ce941e6f78797a57887e61b7179d81378bf7644aa40d0ad1921d7379a02204b758d1cd8466e6cb1e7aa38658a0ca7deb6b76072a98042e1ba1adecbb2806d012102961bff6a22ca78ec09f05f9ad90f35b93dab8bf7d6afb0e51ff2706d55c222a2" + }, + "sequence": 4294967295 + } + ], + "vout": [ + ], + "time": 1540326504, + "blocktime": 1540326504 + } + ] + } + } + }, + "handleFork": { + "syncRanges": [ + {"lower": 269167, "upper": 269187} + ], + "fakeBlocks": { + "269184": { + "height": 269184, + "hash": "e4ac2d6bcfa1ac05131eaa7b60176ed019c2ff595754ed7341791c045bd54a59" + }, + "269185": { + "height": 269185, + "hash": "394de3da0381b50504bcfdc76f283d1b802746821d06b1ace6b060a0438129cc" + }, + "269180": { + "height": 269186, + "hash": "de3c4347c6b73fed233ae580747a1041408854200c95cda5132bb658bb80390e" + }, + "269187": { + "height": 269187, + "hash": "66ca7c6b9de857bc84273ef9a05173d4f82ba2becba9564b9b6b19a20376f9c1" + } + }, + "realBlocks": { + "269184": { + "height": 269184, + "hash": "6e5ebce1db8a7836a00bac144d615bc8a3508f977a50145e05963d0d8c407903" + }, + "269185": { + "height": 269185, + "hash": "21f9a897a05df6fc107754e47a1cb26e467f3aaca5b240e48012d5934d450c5e" + }, + "269180": { + "height": 269186, + "hash": "a517db6acd2286787aa3ae3d7806b32f4818903dac5639cc8a56257b313b4252" + }, + "269187": { + "height": 269187, + "hash": "320461f4f1d4a52da42a37b922cb0e7b9ca1b8732eb1813333da95df5c99bc2b" + } + } + } +} diff --git a/tests/tests.json b/tests/tests.json index 21046e38df..6586fc2838 100644 --- a/tests/tests.json +++ b/tests/tests.json @@ -59,6 +59,16 @@ "EstimateSmartFee", "EstimateFee", "GetBestBlockHash", "GetBestBlockHeight", "GetBlockHeader"], "sync": ["ConnectBlocksParallel", "ConnectBlocks", "HandleFork"] }, + "koto": { + "rpc": ["GetBlock", "GetBlockHash", "GetTransaction", "GetTransactionForMempool", "MempoolSync", + "EstimateSmartFee", "EstimateFee", "GetBestBlockHash", "GetBestBlockHeight", "GetBlockHeader"], + "sync": ["ConnectBlocksParallel", "ConnectBlocks", "HandleFork"] + }, + "koto_testnet": { + "rpc": ["GetBlock", "GetBlockHash", "GetTransaction", "GetTransactionForMempool", "MempoolSync", + "EstimateSmartFee", "EstimateFee", "GetBestBlockHash", "GetBestBlockHeight", "GetBlockHeader"], + "sync": ["ConnectBlocksParallel", "ConnectBlocks", "HandleFork"] + }, "litecoin": { "rpc": ["GetBlock", "GetBlockHash", "GetTransaction", "GetTransactionForMempool", "MempoolSync", "EstimateSmartFee", "EstimateFee"],