From f8be00fa8ebf08099bea51d4d5d39524e3059525 Mon Sep 17 00:00:00 2001 From: poon Date: Tue, 25 May 2021 15:08:39 +0800 Subject: [PATCH] support heco --- Interface/IEthIDChainSubWallet.h | 40 -- SDK/Implement/EthIDChainSubWallet.cpp | 41 -- SDK/Implement/EthIDChainSubWallet.h | 49 -- SDK/Implement/EthSidechainSubWallet.cpp | 12 + SDK/Implement/MasterWallet.cpp | 5 +- SDK/Plugin/Registry.h | 3 +- SDK/SpvService/MainNetConfig.h | 19 + SDK/SpvService/PrvNetConfig.h | 19 + SDK/SpvService/RegTestConfig.h | 19 + SDK/SpvService/TestNetConfig.h | 19 + .../ethereum/blockchain/BREthereumBlock.c | 421 +++++++++++------- .../ethereum/blockchain/BREthereumNetwork.c | 160 ++++++- .../ethereum/blockchain/BREthereumNetwork.h | 6 + 13 files changed, 503 insertions(+), 310 deletions(-) delete mode 100644 Interface/IEthIDChainSubWallet.h delete mode 100644 SDK/Implement/EthIDChainSubWallet.cpp delete mode 100644 SDK/Implement/EthIDChainSubWallet.h diff --git a/Interface/IEthIDChainSubWallet.h b/Interface/IEthIDChainSubWallet.h deleted file mode 100644 index ec0096464..000000000 --- a/Interface/IEthIDChainSubWallet.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2020 Elastos Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ELASTOS_SDK_IETHIDCHAINSUBWALLET_H__ -#define __ELASTOS_SDK_IETHIDCHAINSUBWALLET_H__ - -#include "IEthSidechainSubWallet.h" - -namespace Elastos { - namespace ElaWallet { - - class IEthIDChainSubWallet : public virtual IEthSidechainSubWallet { - public: - virtual ~IEthIDChainSubWallet() noexcept {} - - }; - - } -} - -#endif //__ELASTOS_SDK_IETHIDCHAINSUBWALLET_H__ diff --git a/SDK/Implement/EthIDChainSubWallet.cpp b/SDK/Implement/EthIDChainSubWallet.cpp deleted file mode 100644 index 85ef0c866..000000000 --- a/SDK/Implement/EthIDChainSubWallet.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020 Elastos Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "EthIDChainSubWallet.h" - -namespace Elastos { - namespace ElaWallet { - - EthIDChainSubWallet::~EthIDChainSubWallet() { - - } - - EthIDChainSubWallet::EthIDChainSubWallet(const CoinInfoPtr &info, - const ChainConfigPtr &config, - MasterWallet *parent, - const std::string &netType) : - EthSidechainSubWallet(info, config, parent, netType) { - - } - - } -} \ No newline at end of file diff --git a/SDK/Implement/EthIDChainSubWallet.h b/SDK/Implement/EthIDChainSubWallet.h deleted file mode 100644 index adc833b42..000000000 --- a/SDK/Implement/EthIDChainSubWallet.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2020 Elastos Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ELASTOS_SDK_ETHIDCHAINSUBWALLET_H__ -#define __ELASTOS_SDK_ETHIDCHAINSUBWALLET_H__ - -#include "IEthIDChainSubWallet.h" -#include "EthSidechainSubWallet.h" - -namespace Elastos { - namespace ElaWallet { - - class EthIDChainSubWallet : public EthSidechainSubWallet, public IEthIDChainSubWallet { - public: - virtual ~EthIDChainSubWallet(); - - protected: - friend class MasterWallet; - - EthIDChainSubWallet(const CoinInfoPtr &info, - const ChainConfigPtr &config, - MasterWallet *parent, - const std::string &netType); - }; - - } -} - - -#endif //__ELASTOS_SDK_ETHIDCHAINSUBWALLET_H__ diff --git a/SDK/Implement/EthSidechainSubWallet.cpp b/SDK/Implement/EthSidechainSubWallet.cpp index 7e9d27c47..b23c56870 100644 --- a/SDK/Implement/EthSidechainSubWallet.cpp +++ b/SDK/Implement/EthSidechainSubWallet.cpp @@ -210,6 +210,18 @@ const std::string CALLBACK_IS_NULL_PROMPT = "callback is null"; } else { net = NULL; } + } else if (info->GetChainID() == CHAINID_ETHHECO) { + if (netType == "MainNet") { + net = ethereumHecoMainnet; + } else if (netType == "TestNet") { + net = ethereumHecoTestnet; + } else if (netType == "RegTest") { + net = ethereumHecoRinkeby; + } else if (netType == "PrvNet") { + net = ethereumHecoPrvnet; + } else { + net = NULL; + } } else { if (netType == "MainNet") { net = ethereumMainnet; diff --git a/SDK/Implement/MasterWallet.cpp b/SDK/Implement/MasterWallet.cpp index dc288a067..31b7c610b 100644 --- a/SDK/Implement/MasterWallet.cpp +++ b/SDK/Implement/MasterWallet.cpp @@ -21,7 +21,6 @@ */ #include "IDChainSubWallet.h" #include "EthSidechainSubWallet.h" -#include "EthIDChainSubWallet.h" #include "MainchainSubWallet.h" #include "SubWallet.h" #include "MasterWallet.h" @@ -474,10 +473,8 @@ namespace Elastos { return new IDChainSubWallet(info, config, parent, netType); } else if (info->GetChainID() == "TokenChain") { return new TokenchainSubWallet(info, config, parent, netType); - } else if (info->GetChainID() == "ETHSC") { + } else if (info->GetChainID() == "ETHSC" || info->GetChainID() == "ETHDID" || info->GetChainID() == "ETHHECO") { return new EthSidechainSubWallet(info, config, parent, netType); - } else if (info->GetChainID() == "ETHDID") { - return new EthIDChainSubWallet(info, config, parent, netType); } else { ErrorChecker::ThrowLogicException(Error::InvalidChainID, "Invalid chain ID: " + info->GetChainID()); } diff --git a/SDK/Plugin/Registry.h b/SDK/Plugin/Registry.h index 2f48596cd..39a46a2f5 100644 --- a/SDK/Plugin/Registry.h +++ b/SDK/Plugin/Registry.h @@ -21,8 +21,9 @@ namespace Elastos { #define CHAINID_TOKENCHAIN "TokenChain" #define CHAINID_ESC "ETHSC" #define CHAINID_ETHDID "ETHDID" +#define CHAINID_ETHHECO "ETHHECO" - const std::vector supportChainIDList = {CHAINID_MAINCHAIN, CHAINID_IDCHAIN, CHAINID_TOKENCHAIN, CHAINID_ESC, CHAINID_ETHDID}; + const std::vector supportChainIDList = {CHAINID_MAINCHAIN, CHAINID_IDCHAIN, CHAINID_TOKENCHAIN, CHAINID_ESC, CHAINID_ETHDID, CHAINID_ETHHECO}; class Registry : public boost::noncopyable { public: diff --git a/SDK/SpvService/MainNetConfig.h b/SDK/SpvService/MainNetConfig.h index 8fca9e8b6..ac4e7023b 100644 --- a/SDK/SpvService/MainNetConfig.h +++ b/SDK/SpvService/MainNetConfig.h @@ -216,6 +216,25 @@ namespace Elastos { [0, "6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a", 1, 1] ] } + }, + "ETHHECO": { + "Index": 5, + "MinFee": 0, + "FeePerKB": 0, + "DisconnectionTime": 0, + "ChainParameters": { + "Services": 0, + "MagicNumber": 0, + "StandardPort": 0, + "TargetTimeSpan": 0, + "TargetTimePerBlock": 0, + "DNSSeeds": [ + "127.0.0.1" + ], + "CheckPoints": [ + [0, "5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144", 1, 1] + ] + } } } )"_json; diff --git a/SDK/SpvService/PrvNetConfig.h b/SDK/SpvService/PrvNetConfig.h index c3d6f3a16..674e3069f 100644 --- a/SDK/SpvService/PrvNetConfig.h +++ b/SDK/SpvService/PrvNetConfig.h @@ -104,6 +104,25 @@ namespace Elastos { [0, "44e11ae079dff7583e99c3cc623dd09ae2b6929a55650a13ab468aae1a47a62f", 1, 1] ] } + }, + "ETHHECO": { + "Index": 5, + "MinFee": 0, + "FeePerKB": 0, + "DisconnectionTime": 0, + "ChainParameters": { + "Services": 0, + "MagicNumber": 0, + "StandardPort": 0, + "TargetTimeSpan": 0, + "TargetTimePerBlock": 0, + "DNSSeeds": [ + "127.0.0.1" + ], + "CheckPoints": [ + [0, "5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144", 1, 1] + ] + } } } )"_json; diff --git a/SDK/SpvService/RegTestConfig.h b/SDK/SpvService/RegTestConfig.h index b12d131e0..f51fc2e6a 100644 --- a/SDK/SpvService/RegTestConfig.h +++ b/SDK/SpvService/RegTestConfig.h @@ -179,6 +179,25 @@ namespace Elastos { [0, "6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5", 1, 1] ] } + }, + "ETHHECO": { + "Index": 5, + "MinFee": 0, + "FeePerKB": 0, + "DisconnectionTime": 0, + "ChainParameters": { + "Services": 0, + "MagicNumber": 0, + "StandardPort": 0, + "TargetTimeSpan": 0, + "TargetTimePerBlock": 0, + "DNSSeeds": [ + "127.0.0.1" + ], + "CheckPoints": [ + [0, "5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144", 1, 1] + ] + } } } )"_json; diff --git a/SDK/SpvService/TestNetConfig.h b/SDK/SpvService/TestNetConfig.h index aa09c4cf0..006ac8537 100644 --- a/SDK/SpvService/TestNetConfig.h +++ b/SDK/SpvService/TestNetConfig.h @@ -192,6 +192,25 @@ namespace Elastos { [0, "698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4", 1, 1] ] } + }, + "ETHHECO": { + "Index": 5, + "MinFee": 0, + "FeePerKB": 0, + "DisconnectionTime": 0, + "ChainParameters": { + "Services": 0, + "MagicNumber": 0, + "StandardPort": 0, + "TargetTimeSpan": 0, + "TargetTimePerBlock": 0, + "DNSSeeds": [ + "127.0.0.1" + ], + "CheckPoints": [ + [0, "5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144", 1, 1] + ] + } } } )"_json; diff --git a/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumBlock.c b/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumBlock.c index ca81712a6..53038ae2a 100644 --- a/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumBlock.c +++ b/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumBlock.c @@ -1457,20 +1457,32 @@ static struct BREthereumBlockHeaderRecord genesisMainnetBlockHeaderRecord = { static struct BREthereumBlockHeaderRecord genesisTestnetBlockHeaderRecord; static struct BREthereumBlockHeaderRecord genesisRinkebyBlockHeaderRecord; static struct BREthereumBlockHeaderRecord genesisPrvnetBlockHeaderRecord; + static struct BREthereumBlockHeaderRecord genesisDIDMainnetBlockHeaderRecord; static struct BREthereumBlockHeaderRecord genesisDIDTestnetBlockHeaderRecord; static struct BREthereumBlockHeaderRecord genesisDIDRinkebyBlockHeaderRecord; static struct BREthereumBlockHeaderRecord genesisDIDPrvnetBlockHeaderRecord; +static struct BREthereumBlockHeaderRecord genesisHecoMainnetBlockHeaderRecord; +static struct BREthereumBlockHeaderRecord genesisHecoTestnetBlockHeaderRecord; +static struct BREthereumBlockHeaderRecord genesisHecoRinkebyBlockHeaderRecord; +static struct BREthereumBlockHeaderRecord genesisHecoPrvnetBlockHeaderRecord; + const BREthereumBlockHeader ethereumMainnetBlockHeader = &genesisMainnetBlockHeaderRecord; const BREthereumBlockHeader ethereumTestnetBlockHeader = &genesisTestnetBlockHeaderRecord; const BREthereumBlockHeader ethereumRinkebyBlockHeader = &genesisRinkebyBlockHeaderRecord; const BREthereumBlockHeader ethereumPrvnetBlockHeader = &genesisPrvnetBlockHeaderRecord; + const BREthereumBlockHeader ethereumDIDMainnetBlockHeader = &genesisDIDMainnetBlockHeaderRecord; const BREthereumBlockHeader ethereumDIDTestnetBlockHeader = &genesisDIDTestnetBlockHeaderRecord; const BREthereumBlockHeader ethereumDIDRinkebyBlockHeader = &genesisDIDRinkebyBlockHeaderRecord; const BREthereumBlockHeader ethereumDIDPrvnetBlockHeader = &genesisDIDPrvnetBlockHeaderRecord; +const BREthereumBlockHeader ethereumHecoMainnetBlockHeader = &genesisHecoMainnetBlockHeaderRecord; +const BREthereumBlockHeader ethereumHecoTestnetBlockHeader = &genesisHecoTestnetBlockHeaderRecord; +const BREthereumBlockHeader ethereumHecoRinkebyBlockHeader = &genesisHecoRinkebyBlockHeaderRecord; +const BREthereumBlockHeader ethereumHecoPrvnetBlockHeader = &genesisHecoPrvnetBlockHeaderRecord; + static void initializeGenesisBlocks (void); @@ -1483,15 +1495,34 @@ networkGetGenesisBlockHeader (BREthereumNetwork network) { initializeGenesisBlocks(); } - BREthereumBlockHeader genesisHeader = - (network == ethereumMainnet ? ethereumMainnetBlockHeader - : (network == ethereumTestnet ? ethereumTestnetBlockHeader - : (network == ethereumRinkeby ? ethereumRinkebyBlockHeader - : (network == ethereumPrvnet ? ethereumPrvnetBlockHeader - : (network == ethereumDIDMainnet ? ethereumDIDMainnetBlockHeader - : (network == ethereumDIDTestnet ? ethereumDIDTestnetBlockHeader - : (network == ethereumDIDRinkeby ? ethereumDIDRinkebyBlockHeader - : (network == ethereumDIDPrvnet ? ethereumDIDPrvnetBlockHeader : NULL)))))))); + BREthereumBlockHeader genesisHeader = NULL; + + + if (network == ethereumMainnet) { + genesisHeader = ethereumMainnetBlockHeader; + } else if (network == ethereumTestnet) { + genesisHeader = ethereumTestnetBlockHeader; + } else if (network == ethereumRinkeby) { + genesisHeader = ethereumRinkebyBlockHeader; + } else if (network == ethereumPrvnet) { + genesisHeader = ethereumPrvnetBlockHeader; + } else if (network == ethereumDIDMainnet) { // DID + genesisHeader = ethereumDIDMainnetBlockHeader; + } else if (network == ethereumDIDTestnet) { + genesisHeader = ethereumDIDTestnetBlockHeader; + } else if (network == ethereumDIDRinkeby) { + genesisHeader = ethereumDIDRinkebyBlockHeader; + } else if (network == ethereumDIDPrvnet) { + genesisHeader = ethereumDIDPrvnetBlockHeader; + } else if (network == ethereumHecoMainnet) { // HECO + genesisHeader = ethereumHecoMainnetBlockHeader; + } else if (network == ethereumHecoTestnet) { + genesisHeader = ethereumHecoTestnetBlockHeader; + } else if (network == ethereumHecoRinkeby) { + genesisHeader = ethereumHecoRinkebyBlockHeader; + } else if (network == ethereumHecoPrvnet) { + genesisHeader = ethereumHecoPrvnetBlockHeader; + } return genesisHeader == NULL ? NULL : blockHeaderCopy(genesisHeader); } @@ -1507,7 +1538,6 @@ static void initializeGenesisBlocks (void) { BREthereumBlockHeader header; - // Mainnet /* {"jsonrpc":"2.0","id":1,"result": { @@ -1537,30 +1567,8 @@ initializeGenesisBlocks (void) { "uncles":[] }} */ - /* -{ - difficulty: 1, - extraData: "0x00000000000000000000000000000000000000000000000000000000000000005141f2c88e84c0f9b4c1876df59e2530fbdc42f2f02090aec7d41b1880058cf5155fe030c3ec404e08319622794adcf7c05d9e8f6d251c3309e0ec3c8609fadecdc27e135343b7c8bdbf25f09a01458277466b8b6fbb66ac1db38343af158b22636996788207c68a3345104698ae24c4847bf748a32c97d158f0d33873227887ecf514064e3a7b94754ecb68470e2a9002b6aa3197cbec11f46971c73d79a8e80ddb5d59d98347dbbc60c63d09213e5fac0cbc6d8f547cedf3b298182abf49be4a717db9a0d14509fddb0ca03ffc56463ec0e6dda91c99f70a7bca505223c679c4bfdaee3463636ee4a8ff022b46e9eb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - gasLimit: 8700000000, - gasUsed: 0, - hash: "0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a", - logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - miner: "0x0000000000000000000000000000000000000000", - mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000", - nonce: "0x0000000000000000", - number: 0, - parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000", - receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - size: 845, - stateRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - timestamp: 1, - totalDifficulty: 1, - transactions: [], - transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - uncles: [] -} - */ + + // Mainnet header = &genesisMainnetBlockHeaderRecord; header->hash = hashCreate("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); @@ -1580,8 +1588,9 @@ initializeGenesisBlocks (void) { header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; - header = &genesisDIDMainnetBlockHeaderRecord; - header->hash = hashCreate("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); + // Testnet + header = &genesisTestnetBlockHeaderRecord; + header->hash = hashCreate("0x698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); @@ -1589,65 +1598,19 @@ initializeGenesisBlocks (void) { header->transactionsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); header->receiptsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); header->logsBloom = bloomFilterCreateString("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); - header->difficulty = createUInt256 (1); + header->difficulty = createUInt256 (0x1); header->number = 0x0; header->gasLimit = 8700000000; header->gasUsed = 0x0; - header->timestamp = 0x1; - decodeHex(header->extraData, 337, "00000000000000000000000000000000000000000000000000000000000000005141f2c88e84c0f9b4c1876df59e2530fbdc42f2f02090aec7d41b1880058cf5155fe030c3ec404e08319622794adcf7c05d9e8f6d251c3309e0ec3c8609fadecdc27e135343b7c8bdbf25f09a01458277466b8b6fbb66ac1db38343af158b22636996788207c68a3345104698ae24c4847bf748a32c97d158f0d33873227887ecf514064e3a7b94754ecb68470e2a9002b6aa3197cbec11f46971c73d79a8e80ddb5d59d98347dbbc60c63d09213e5fac0cbc6d8f547cedf3b298182abf49be4a717db9a0d14509fddb0ca03ffc56463ec0e6dda91c99f70a7bca505223c679c4bfdaee3463636ee4a8ff022b46e9eb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); + header->timestamp = 1541053856; + decodeHex(header->extraData, 337, "0000000000000000000000000000000000000000000000000000000000000000d7b0ddec94d96d4c7870deac1a2fe3347b9b4b854dd0dd5e78c10842544cc1e88b5e1fcc3532abe1bb6ef39991b88e0121689a298d16b34dfca431561d8b61c0300fa3b6167bd76ad82c90feab038af0f3ca004f36ee4d3510553564bdb81ab5f1a5d4ed412a0777ad9bed14c4d53a883f618eb86de1723dedabf5d5fb905ef2148dcf3fdc08d53f03d534a5143b49ff57efc134816017a5cd0b99058946781f8c60febab3495b66047aaaac8639a2d0bd911737473e7ea53fbf71e091703893dd9b6d5b96a83db1b8ae7e3346330073552e1b7c8403f4e107406ff7d168f2f37649f1a5cf1cbc173e02e2897ccd83b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); header->extraDataCount = 337; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; - // Testnet - /* - {"jsonrpc":"2.0","id":1,"result": - {"difficulty":"0x100000", - "extraData":"0x3535353535353535353535353535353535353535353535353535353535353535", - "gasLimit":"0x1000000", - "gasUsed":"0x0", - "hash":"0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d", - "logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner":"0x0000000000000000000000000000000000000000", - "mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce":"0x0000000000000042", - "number":"0x0", - "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "size":"0x21c", - "stateRoot":"0x217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b", - "timestamp":"0x0", - "totalDifficulty":"0x100000", - "transactions":[], - "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles":[]}} - */ - /* - { - difficulty: 1, - extraData: "0x0000000000000000000000000000000000000000000000000000000000000000d7b0ddec94d96d4c7870deac1a2fe3347b9b4b854dd0dd5e78c10842544cc1e88b5e1fcc3532abe1bb6ef39991b88e0121689a298d16b34dfca431561d8b61c0300fa3b6167bd76ad82c90feab038af0f3ca004f36ee4d3510553564bdb81ab5f1a5d4ed412a0777ad9bed14c4d53a883f618eb86de1723dedabf5d5fb905ef2148dcf3fdc08d53f03d534a5143b49ff57efc134816017a5cd0b99058946781f8c60febab3495b66047aaaac8639a2d0bd911737473e7ea53fbf71e091703893dd9b6d5b96a83db1b8ae7e3346330073552e1b7c8403f4e107406ff7d168f2f37649f1a5cf1cbc173e02e2897ccd83b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - gasLimit: 8700000000, - gasUsed: 0, - hash: "0x698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4", - logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - miner: "0x0000000000000000000000000000000000000000", - mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000", - nonce: "0x0000000000000000", - number: 0, - parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000", - receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - size: 849, - stateRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - timestamp: 1541053856, - totalDifficulty: 1, - transactions: [], - transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - uncles: [] -} - */ - header = &genesisTestnetBlockHeaderRecord; - header->hash = hashCreate("0x698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4"); + + // Rinkeby + header = &genesisRinkebyBlockHeaderRecord; + header->hash = hashCreate("0x6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); @@ -1659,13 +1622,15 @@ initializeGenesisBlocks (void) { header->number = 0x0; header->gasLimit = 8700000000; header->gasUsed = 0x0; - header->timestamp = 1541053856; - decodeHex(header->extraData, 337, "0000000000000000000000000000000000000000000000000000000000000000d7b0ddec94d96d4c7870deac1a2fe3347b9b4b854dd0dd5e78c10842544cc1e88b5e1fcc3532abe1bb6ef39991b88e0121689a298d16b34dfca431561d8b61c0300fa3b6167bd76ad82c90feab038af0f3ca004f36ee4d3510553564bdb81ab5f1a5d4ed412a0777ad9bed14c4d53a883f618eb86de1723dedabf5d5fb905ef2148dcf3fdc08d53f03d534a5143b49ff57efc134816017a5cd0b99058946781f8c60febab3495b66047aaaac8639a2d0bd911737473e7ea53fbf71e091703893dd9b6d5b96a83db1b8ae7e3346330073552e1b7c8403f4e107406ff7d168f2f37649f1a5cf1cbc173e02e2897ccd83b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); + header->timestamp = 1541053864; + // TODO: Rinkeby ExtraData is oversized... ignore. + decodeHex(header->extraData, 337, "00000000000000000000000000000000000000000000000000000000000000007117360e9165f11c51c4231be16c602a5dd250b6aeabe3dd7b80adf0a884e572e84daf5eba0aa4ae8bb95e8f1ec991b71789497a09fd4997c468c3c277cd931d4864039fa48220f817519f5a8b0715b334185174992c36c79f78da5e009b9c22732738d635ae1cbf8c5a01a40943aff7e0c8d5d3c625bf96971037c3e90bb239b5b219b7ac14c8e301dca5f875ed22d90568dd99c56cb34c8d5204d610cb2b6107ebaaee24a9d8dd625ca9863af2347656df876a369c5f2b099abb3c050b8ba4355cf0dc29ebf4296e32b1fff289d05e719a58e1ad1fff1a924014c872064cd776e12d7163d329cc003bffb1b8b9de440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); header->extraDataCount = 337; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; - header = &genesisDIDTestnetBlockHeaderRecord; + // Prvnet + header = &genesisPrvnetBlockHeaderRecord; header->hash = hashCreate("0x698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); @@ -1683,56 +1648,13 @@ initializeGenesisBlocks (void) { header->extraDataCount = 337; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; - // Rinkeby - /* - {"jsonrpc":"2.0","id":1,"result": - {"difficulty":"0x1", - "extraData":"0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "gasLimit":"0x47b760", - "gasUsed":"0x0", - "hash":"0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177", - "logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "miner":"0x0000000000000000000000000000000000000000", - "mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce":"0x0000000000000000", - "number":"0x0", - "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "size":"0x29a", - "stateRoot":"0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d", - "timestamp":"0x58ee40ba", - "totalDifficulty":"0x1", - "transactions":[], - "transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncles":[]}} - */ - /* - { - difficulty: 1, - extraData: "0x00000000000000000000000000000000000000000000000000000000000000007117360e9165f11c51c4231be16c602a5dd250b6aeabe3dd7b80adf0a884e572e84daf5eba0aa4ae8bb95e8f1ec991b71789497a09fd4997c468c3c277cd931d4864039fa48220f817519f5a8b0715b334185174992c36c79f78da5e009b9c22732738d635ae1cbf8c5a01a40943aff7e0c8d5d3c625bf96971037c3e90bb239b5b219b7ac14c8e301dca5f875ed22d90568dd99c56cb34c8d5204d610cb2b6107ebaaee24a9d8dd625ca9863af2347656df876a369c5f2b099abb3c050b8ba4355cf0dc29ebf4296e32b1fff289d05e719a58e1ad1fff1a924014c872064cd776e12d7163d329cc003bffb1b8b9de440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - gasLimit: 8700000000, - gasUsed: 0, - hash: "0x6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5", - logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - miner: "0x0000000000000000000000000000000000000000", - mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000", - nonce: "0x0000000000000000", - number: 0, - parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000", - receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - size: 849, - stateRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - timestamp: 1541053864, - totalDifficulty: 1, - transactions: [], - transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - uncles: [] -} + + /** + * DID */ - header = &genesisRinkebyBlockHeaderRecord; - header->hash = hashCreate("0x6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5"); + // Mainnet + header = &genesisDIDMainnetBlockHeaderRecord; + header->hash = hashCreate("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); @@ -1740,19 +1662,19 @@ initializeGenesisBlocks (void) { header->transactionsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); header->receiptsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); header->logsBloom = bloomFilterCreateString("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); - header->difficulty = createUInt256 (0x1); + header->difficulty = createUInt256 (1); header->number = 0x0; header->gasLimit = 8700000000; header->gasUsed = 0x0; - header->timestamp = 1541053864; - // TODO: Rinkeby ExtraData is oversized... ignore. - decodeHex(header->extraData, 337, "00000000000000000000000000000000000000000000000000000000000000007117360e9165f11c51c4231be16c602a5dd250b6aeabe3dd7b80adf0a884e572e84daf5eba0aa4ae8bb95e8f1ec991b71789497a09fd4997c468c3c277cd931d4864039fa48220f817519f5a8b0715b334185174992c36c79f78da5e009b9c22732738d635ae1cbf8c5a01a40943aff7e0c8d5d3c625bf96971037c3e90bb239b5b219b7ac14c8e301dca5f875ed22d90568dd99c56cb34c8d5204d610cb2b6107ebaaee24a9d8dd625ca9863af2347656df876a369c5f2b099abb3c050b8ba4355cf0dc29ebf4296e32b1fff289d05e719a58e1ad1fff1a924014c872064cd776e12d7163d329cc003bffb1b8b9de440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); + header->timestamp = 0x1; + decodeHex(header->extraData, 337, "00000000000000000000000000000000000000000000000000000000000000005141f2c88e84c0f9b4c1876df59e2530fbdc42f2f02090aec7d41b1880058cf5155fe030c3ec404e08319622794adcf7c05d9e8f6d251c3309e0ec3c8609fadecdc27e135343b7c8bdbf25f09a01458277466b8b6fbb66ac1db38343af158b22636996788207c68a3345104698ae24c4847bf748a32c97d158f0d33873227887ecf514064e3a7b94754ecb68470e2a9002b6aa3197cbec11f46971c73d79a8e80ddb5d59d98347dbbc60c63d09213e5fac0cbc6d8f547cedf3b298182abf49be4a717db9a0d14509fddb0ca03ffc56463ec0e6dda91c99f70a7bca505223c679c4bfdaee3463636ee4a8ff022b46e9eb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); header->extraDataCount = 337; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; - header = &genesisDIDRinkebyBlockHeaderRecord; - header->hash = hashCreate("0x6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5"); + // Testnet + header = &genesisDIDTestnetBlockHeaderRecord; + header->hash = hashCreate("0x698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); @@ -1764,16 +1686,15 @@ initializeGenesisBlocks (void) { header->number = 0x0; header->gasLimit = 8700000000; header->gasUsed = 0x0; - header->timestamp = 1541053864; - // TODO: Rinkeby ExtraData is oversized... ignore. - decodeHex(header->extraData, 337, "00000000000000000000000000000000000000000000000000000000000000007117360e9165f11c51c4231be16c602a5dd250b6aeabe3dd7b80adf0a884e572e84daf5eba0aa4ae8bb95e8f1ec991b71789497a09fd4997c468c3c277cd931d4864039fa48220f817519f5a8b0715b334185174992c36c79f78da5e009b9c22732738d635ae1cbf8c5a01a40943aff7e0c8d5d3c625bf96971037c3e90bb239b5b219b7ac14c8e301dca5f875ed22d90568dd99c56cb34c8d5204d610cb2b6107ebaaee24a9d8dd625ca9863af2347656df876a369c5f2b099abb3c050b8ba4355cf0dc29ebf4296e32b1fff289d05e719a58e1ad1fff1a924014c872064cd776e12d7163d329cc003bffb1b8b9de440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); + header->timestamp = 1541053856; + decodeHex(header->extraData, 337, "0000000000000000000000000000000000000000000000000000000000000000d7b0ddec94d96d4c7870deac1a2fe3347b9b4b854dd0dd5e78c10842544cc1e88b5e1fcc3532abe1bb6ef39991b88e0121689a298d16b34dfca431561d8b61c0300fa3b6167bd76ad82c90feab038af0f3ca004f36ee4d3510553564bdb81ab5f1a5d4ed412a0777ad9bed14c4d53a883f618eb86de1723dedabf5d5fb905ef2148dcf3fdc08d53f03d534a5143b49ff57efc134816017a5cd0b99058946781f8c60febab3495b66047aaaac8639a2d0bd911737473e7ea53fbf71e091703893dd9b6d5b96a83db1b8ae7e3346330073552e1b7c8403f4e107406ff7d168f2f37649f1a5cf1cbc173e02e2897ccd83b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); header->extraDataCount = 337; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; - // Prvnet - header = &genesisPrvnetBlockHeaderRecord; - header->hash = hashCreate("0x698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4"); + // Rinkeby + header = &genesisDIDRinkebyBlockHeaderRecord; + header->hash = hashCreate("0x6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); @@ -1785,12 +1706,14 @@ initializeGenesisBlocks (void) { header->number = 0x0; header->gasLimit = 8700000000; header->gasUsed = 0x0; - header->timestamp = 1541053856; - decodeHex(header->extraData, 337, "0000000000000000000000000000000000000000000000000000000000000000d7b0ddec94d96d4c7870deac1a2fe3347b9b4b854dd0dd5e78c10842544cc1e88b5e1fcc3532abe1bb6ef39991b88e0121689a298d16b34dfca431561d8b61c0300fa3b6167bd76ad82c90feab038af0f3ca004f36ee4d3510553564bdb81ab5f1a5d4ed412a0777ad9bed14c4d53a883f618eb86de1723dedabf5d5fb905ef2148dcf3fdc08d53f03d534a5143b49ff57efc134816017a5cd0b99058946781f8c60febab3495b66047aaaac8639a2d0bd911737473e7ea53fbf71e091703893dd9b6d5b96a83db1b8ae7e3346330073552e1b7c8403f4e107406ff7d168f2f37649f1a5cf1cbc173e02e2897ccd83b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); + header->timestamp = 1541053864; + // TODO: Rinkeby ExtraData is oversized... ignore. + decodeHex(header->extraData, 337, "00000000000000000000000000000000000000000000000000000000000000007117360e9165f11c51c4231be16c602a5dd250b6aeabe3dd7b80adf0a884e572e84daf5eba0aa4ae8bb95e8f1ec991b71789497a09fd4997c468c3c277cd931d4864039fa48220f817519f5a8b0715b334185174992c36c79f78da5e009b9c22732738d635ae1cbf8c5a01a40943aff7e0c8d5d3c625bf96971037c3e90bb239b5b219b7ac14c8e301dca5f875ed22d90568dd99c56cb34c8d5204d610cb2b6107ebaaee24a9d8dd625ca9863af2347656df876a369c5f2b099abb3c050b8ba4355cf0dc29ebf4296e32b1fff289d05e719a58e1ad1fff1a924014c872064cd776e12d7163d329cc003bffb1b8b9de440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 674); header->extraDataCount = 337; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; + // Prvnet header = &genesisDIDPrvnetBlockHeaderRecord; header->hash = hashCreate("0x44e11ae079dff7583e99c3cc623dd09ae2b6929a55650a13ab468aae1a47a62f"); header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); @@ -1809,10 +1732,94 @@ initializeGenesisBlocks (void) { header->extraDataCount = 217; header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); header->nonce = 0x0000000000000000; + + /** + * HECO + */ + // Mainnet + header = &genesisHecoMainnetBlockHeaderRecord; + header->hash = hashCreate("0x5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144"); + header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); + header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); + header->stateRoot = hashCreate("0x51729bfc795a559ded4bffb967bd671773710d58c7e788e0cad466a79361d32f"); + header->transactionsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->receiptsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->logsBloom = bloomFilterCreateString("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + header->difficulty = createUInt256 (1); + header->number = 0x0; + header->gasLimit = 42000000; + header->gasUsed = 0x0; + header->timestamp = 1606781288; + decodeHex(header->extraData, 117, "0000000000000000000000000000000000000000000000000000000000000000fc20f6a8a1a65a91f838247b4f460437a5a68bca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 234); + header->extraDataCount = 117; + header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->nonce = 0x0000000000000000; + + // Testnet + header = &genesisHecoTestnetBlockHeaderRecord; + header->hash = hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); + header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); + header->stateRoot = hashCreate("0x170ae623e5c64770669679731af9dbff8f3bd9535d1f7fb0454b311410b7e9fb"); + header->transactionsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->receiptsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->logsBloom = bloomFilterCreateString("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + header->difficulty = createUInt256 (1); + header->number = 0x0; + header->gasLimit = 42000000; + header->gasUsed = 0x0; + header->timestamp = 1606781288; + decodeHex(header->extraData, 117, "0000000000000000000000000000000000000000000000000000000000000000fc20f6a8a1a65a91f838247b4f460437a5a68bca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 234); + header->extraDataCount = 117; + header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->nonce = 0x0000000000000000; + + // Rinkeby + header = &genesisHecoRinkebyBlockHeaderRecord; + header->hash = hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); + header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); + header->stateRoot = hashCreate("0x170ae623e5c64770669679731af9dbff8f3bd9535d1f7fb0454b311410b7e9fb"); + header->transactionsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->receiptsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->logsBloom = bloomFilterCreateString("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + header->difficulty = createUInt256 (1); + header->number = 0x0; + header->gasLimit = 42000000; + header->gasUsed = 0x0; + header->timestamp = 1606781288; + decodeHex(header->extraData, 117, "0000000000000000000000000000000000000000000000000000000000000000fc20f6a8a1a65a91f838247b4f460437a5a68bca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 234); + header->extraDataCount = 117; + header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->nonce = 0x0000000000000000; + + // Prvnet + header = &genesisHecoPrvnetBlockHeaderRecord; + header->hash = hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + header->parentHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->ommersHash = hashCreate("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"); + header->beneficiary = addressCreate("0x0000000000000000000000000000000000000000"); + header->stateRoot = hashCreate("0x170ae623e5c64770669679731af9dbff8f3bd9535d1f7fb0454b311410b7e9fb"); + header->transactionsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->receiptsRoot = hashCreate("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); + header->logsBloom = bloomFilterCreateString("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + header->difficulty = createUInt256 (1); + header->number = 0x0; + header->gasLimit = 42000000; + header->gasUsed = 0x0; + header->timestamp = 1606781288; + decodeHex(header->extraData, 117, "0000000000000000000000000000000000000000000000000000000000000000fc20f6a8a1a65a91f838247b4f460437a5a68bca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 234); + header->extraDataCount = 117; + header->mixHash = hashCreate("0x0000000000000000000000000000000000000000000000000000000000000000"); + header->nonce = 0x0000000000000000; } /// MARK: - Block Checkpoint +// mainnet static BREthereumBlockCheckpoint ethereumMainnetCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 0x1 }, @@ -1822,6 +1829,7 @@ const char *mainnetCheckpointString[CHECKPOINT_MAINNET_COUNT] = { "6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a" }; +// testnet static BREthereumBlockCheckpoint ethereumTestnetCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053856 }, // 1061 days 6 hrs ago (Jul-30-2015 03:26:13 PM +UTC) @@ -1831,6 +1839,7 @@ const char *testnetCheckpointsString[CHECKPOINT_TESTNET_COUNT] = { "698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4" }; +// rinkeby static BREthereumBlockCheckpoint ethereumRinkebyCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053864 }, // 439 days 6 hrs ago (Apr-12-2017 03:20:50 PM +UTC) @@ -1840,6 +1849,7 @@ const char *rinkebyCheckpointsString[CHECKPOINT_RINKEBY_COUNT] = { "6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5" }; +// prvnet static BREthereumBlockCheckpoint ethereumPrvnetCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053856 }, // 1061 days 6 hrs ago (Jul-30-2015 03:26:13 PM +UTC) @@ -1849,6 +1859,10 @@ const char *prvnetCheckpointsString[CHECKPOINT_PRVNET_COUNT] = { "698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4" }; +/** + * DID + */ + // mainnet static BREthereumBlockCheckpoint ethereumDIDMainnetCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 0x1 }, @@ -1858,6 +1872,7 @@ const char *didmainnetCheckpointsString[CHECKPOINT_DID_MAINNET_COUNT] = { "6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a" }; +// testnet static BREthereumBlockCheckpoint ethereumDIDTestnetCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053856 }, // 1061 days 6 hrs ago (Jul-30-2015 03:26:13 PM +UTC) @@ -1867,6 +1882,7 @@ const char *didtestnetCheckpointsString[CHECKPOINT_DID_TESTNET_COUNT] = { "698e5ec133064dabb7c42eb4b2bdfa21e7b7c2326b0b719d5ab7f452ae8f5ee4" }; +// rinkeby static BREthereumBlockCheckpoint ethereumDIDRinkebyCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053864 }, // 439 days 6 hrs ago (Apr-12-2017 03:20:50 PM +UTC) @@ -1876,6 +1892,7 @@ const char *didrinkebyCheckpointsString[CHECKPOINT_DID_RINKEBY_COUNT] = { "6940d4ee80218d11098c99db11e997686e587ec482c7281e015c12f1152e71b5" }; +// prvnet static BREthereumBlockCheckpoint ethereumDIDPrvnetCheckpoints [] = { { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 0x5d8adde5 }, // 1061 days 6 hrs ago (Jul-30-2015 03:26:13 PM +UTC) @@ -1885,6 +1902,49 @@ const char *didprvnetCheckpointsString[CHECKPOINT_DID_PRVNET_COUNT] = { "44e11ae079dff7583e99c3cc623dd09ae2b6929a55650a13ab468aae1a47a62f" }; +/** + * HECO + */ +// mainnet +static BREthereumBlockCheckpoint + ethereumHecoMainnetCheckpoints [] = { + { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 0x1 }, +}; +#define CHECKPOINT_HECO_MAINNET_COUNT (sizeof (ethereumHecoMainnetCheckpoints) / sizeof (BREthereumBlockCheckpoint)) +const char *hecomainnetCheckpointsString[CHECKPOINT_DID_MAINNET_COUNT] = { + "5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144" +}; + +// testnet +static BREthereumBlockCheckpoint + ethereumHecoTestnetCheckpoints [] = { + { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053856 }, // 1061 days 6 hrs ago (Jul-30-2015 03:26:13 PM +UTC) +}; +#define CHECKPOINT_HECO_TESTNET_COUNT (sizeof (ethereumDIDTestnetCheckpoints) / sizeof (BREthereumBlockCheckpoint)) +const char *hecotestnetCheckpointsString[CHECKPOINT_HECO_TESTNET_COUNT] = { + "b24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad" +}; + +// rinkeby +static BREthereumBlockCheckpoint + ethereumHecoRinkebyCheckpoints [] = { + { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 1541053864 }, // 439 days 6 hrs ago (Apr-12-2017 03:20:50 PM +UTC) +}; +#define CHECKPOINT_HECO_RINKEBY_COUNT (sizeof (ethereumDIDRinkebyCheckpoints) / sizeof (BREthereumBlockCheckpoint)) +const char *hecorinkebyCheckpointsString[CHECKPOINT_HECO_RINKEBY_COUNT] = { + "b24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad" +}; + +// prvnet +static BREthereumBlockCheckpoint + ethereumHecoPrvnetCheckpoints [] = { + { 0, EMPTY_HASH_INIT, { .std = "0x1" }, 0x5d8adde5 }, // 1061 days 6 hrs ago (Jul-30-2015 03:26:13 PM +UTC) +}; +#define CHECKPOINT_HECO_PRVNET_COUNT (sizeof (ethereumDIDPrvnetCheckpoints) / sizeof (BREthereumBlockCheckpoint)) +const char *hecoprvnetCheckpointsString[CHECKPOINT_HECO_PRVNET_COUNT] = { + "b24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad" +}; + static void blockCheckpointInitialize (void) { static int needInitialization = 1; if (needInitialization) { @@ -1948,6 +2008,36 @@ static void blockCheckpointInitialize (void) { cp->u.td = createUInt256Parse (cp->u.std, 0, &status); assert (CORE_PARSE_OK == status); } + + // heco + for (size_t index = 0; index < CHECKPOINT_HECO_MAINNET_COUNT; index++) { + BREthereumBlockCheckpoint *cp = ðereumHecoMainnetCheckpoints[index]; + cp->hash = HASH_INIT(hecomainnetCheckpointsString[index]); + cp->u.td = createUInt256Parse (cp->u.std, 0, &status); + assert (CORE_PARSE_OK == status); + } + + for (size_t index = 0; index < CHECKPOINT_HECO_TESTNET_COUNT; index++) { + BREthereumBlockCheckpoint *cp = ðereumHecoTestnetCheckpoints[index]; + cp->hash = HASH_INIT(hecotestnetCheckpointsString[index]); + cp->u.td = createUInt256Parse (cp->u.std, 0, &status); + assert (CORE_PARSE_OK == status); + } + + for (size_t index = 0; index < CHECKPOINT_HECO_RINKEBY_COUNT; index++) { + BREthereumBlockCheckpoint *cp = ðereumHecoRinkebyCheckpoints[index]; + cp->hash = HASH_INIT(hecorinkebyCheckpointsString[index]); + cp->u.td = createUInt256Parse (cp->u.std, 0, &status); + assert (CORE_PARSE_OK == status); + } + + for (size_t index = 0; index < CHECKPOINT_HECO_PRVNET_COUNT; index++) { + BREthereumBlockCheckpoint *cp = ðereumHecoPrvnetCheckpoints[index]; + cp->hash = HASH_INIT(hecoprvnetCheckpointsString[index]); + cp->u.td = createUInt256Parse (cp->u.std, 0, &status); + assert (CORE_PARSE_OK == status); + } + } } @@ -1998,6 +2088,27 @@ blockCheckpointFindForNetwork (BREthereumNetwork network, return ethereumDIDPrvnetCheckpoints; } + // heco + if (network == ethereumHecoMainnet) { + *count = CHECKPOINT_HECO_MAINNET_COUNT; + return ethereumHecoMainnetCheckpoints; + } + + if (network == ethereumHecoTestnet) { + *count = CHECKPOINT_HECO_TESTNET_COUNT; + return ethereumHecoTestnetCheckpoints; + } + + if (network == ethereumHecoRinkeby) { + *count = CHECKPOINT_HECO_RINKEBY_COUNT; + return ethereumHecoRinkebyCheckpoints; + } + + if (network == ethereumHecoPrvnet) { + *count = CHECKPOINT_HECO_PRVNET_COUNT; + return ethereumHecoPrvnetCheckpoints; + } + *count = 0; return NULL; } diff --git a/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.c b/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.c index 540a6e62c..08354b262 100644 --- a/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.c +++ b/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.c @@ -370,6 +370,115 @@ static struct BREthereumNetworkRecord ethereumDIDPrvnetRecord = { }; const BREthereumNetwork ethereumDIDPrvnet = ðereumDIDPrvnetRecord; +// +// HECO Mainnet +// +static struct BREthereumNetworkRecord ethereumHecoMainnetRecord = { + "mainnet-heco", + 0x80, + 0x80, + EMPTY_HASH_INIT, + EMPTY_HASH_INIT, + // Seeds + { //"seed.mainnet.eth.brd.breadwallet.com", + //"seed.mainnet.eth.community.breadwallet.com", + NULL }, + + // Enodes + + // BRD + { "enode://7bed18c87054f807bc9096501bc78f737363f357af831791bab07c4fa6c5a1a67cdcf0a097dc2cc918262ef04fb1c05c26026df5c11a6a56666f9b1fb4072210@18.178.30.66:32668", + "enode://d67251dd3b050e555679a8abdc427a4c78a9bae174f2fd3b9163c364d27b6a69688ee067cd3214e8ceb71e6e602fd812797b085ae37ed3bf93b78e2b77ae3306@18.181.40.7:32668", + "enode://f88bb1f5d0e42cf75ec879212b7c8477d605315d5296fba02bc4600eccf73c64427de46567a320d00985d5bc612168817ba6dff169bd6a4774e112e6db0ff6a2@18.176.66.118:32668", + NULL }, + + // Community + { NULL }, + + // Local - Parity + { NULL }, + + // Local - Geth + { NULL } +}; +const BREthereumNetwork ethereumHecoMainnet = ðereumHecoMainnetRecord; + +// +// HECO Testnet +// +static struct BREthereumNetworkRecord ethereumHecoTestnetRecord = { + "testnet-heco", // aka "ropsten" + 256, + 256, + EMPTY_HASH_INIT, + EMPTY_HASH_INIT, + // Seeds + { //"seed.ropsten.eth.brd.breadwallet.com", + //"seed.ropsten.eth.community.breadwallet.com", + NULL }, + + // Enodes + + // BRD + { "enode://924543a43d18bc5759a8bdcd17fa9c7c35df63968e9333640b80b58dab94b17a012371c9d46bed10ce7508a607cac76828ca04685893958eee44ade83b856dc2@47.242.237.63:32668", + "enode://ebad898d980b520ef6adb54ffb6a68117686e7332f1ea01f7551b7a296a34dd945445a078d7cad019d864c5ef0e0b7f2b5777d94f93adf7dc59f798af72609ac@47.242.235.121:32668", + NULL }, + { NULL }, + { NULL }, + { NULL } +}; +const BREthereumNetwork ethereumHecoTestnet = ðereumHecoTestnetRecord; + +// +// HECO Rinkeby +// +static struct BREthereumNetworkRecord ethereumHecoRinkebyRecord = { + "rinkeby-heco", + 255, + 255, + EMPTY_HASH_INIT, + EMPTY_HASH_INIT, + // Seeds + { NULL }, + + // Enodes + + { "enode://924543a43d18bc5759a8bdcd17fa9c7c35df63968e9333640b80b58dab94b17a012371c9d46bed10ce7508a607cac76828ca04685893958eee44ade83b856dc2@47.242.237.63:32668", + "enode://ebad898d980b520ef6adb54ffb6a68117686e7332f1ea01f7551b7a296a34dd945445a078d7cad019d864c5ef0e0b7f2b5777d94f93adf7dc59f798af72609ac@47.242.235.121:32668", + NULL }, + { NULL }, + { NULL }, + { NULL } +}; +const BREthereumNetwork ethereumHecoRinkeby = ðereumHecoRinkebyRecord; + +// +// HECO Prvnet +// +static struct BREthereumNetworkRecord ethereumHecoPrvnetRecord = { + "prvnet-heco", // aka "ropsten" + 255, + 255, + EMPTY_HASH_INIT, + EMPTY_HASH_INIT, + // Seeds + { //"seed.ropsten.eth.brd.breadwallet.com", + //"seed.ropsten.eth.community.breadwallet.com", + NULL }, + + // Enodes + + // BRD + {"enode://924543a43d18bc5759a8bdcd17fa9c7c35df63968e9333640b80b58dab94b17a012371c9d46bed10ce7508a607cac76828ca04685893958eee44ade83b856dc2@47.242.237.63:32668", + "enode://ebad898d980b520ef6adb54ffb6a68117686e7332f1ea01f7551b7a296a34dd945445a078d7cad019d864c5ef0e0b7f2b5777d94f93adf7dc59f798af72609ac@47.242.235.121:32668", + NULL }, + { NULL }, + { NULL }, + { NULL } +}; +const BREthereumNetwork ethereumHecoPrvnet = ðereumHecoPrvnetRecord; + + /* // RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network. RinkebyChainConfig = &ChainConfig{ @@ -437,70 +546,81 @@ networkInitilizeAllIfAppropriate (void) { if (needsInitialization) { // Mainnet - ethereumMainnetRecord.genesisBlockHeaderHash = - hashCreate ("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"); - + hashCreate ("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); ethereumMainnetRecord.trustedCheckpointBlockHeaderHash = - hashCreate("0x04c2114a8cbe49ba5c37a03cc4b4b8d3adfc0bd2c78e0e726405dd84afca1d63"); + hashCreate("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); // Testnet / 'Ropsten' - ethereumTestnetRecord.genesisBlockHeaderHash = hashCreate("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"); - ethereumTestnetRecord.trustedCheckpointBlockHeaderHash = hashCreate("0x1b1ba890510e06411fdee9bb64ca7705c56a1a4ce3559ddb34b3680c526cb419"); // Rinkeby - ethereumRinkebyRecord.genesisBlockHeaderHash = hashCreate("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"); - ethereumRinkebyRecord.trustedCheckpointBlockHeaderHash = hashCreate("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"); // Prvnet - ethereumPrvnetRecord.genesisBlockHeaderHash = hashCreate("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"); - ethereumPrvnetRecord.trustedCheckpointBlockHeaderHash = hashCreate("0x1b1ba890510e06411fdee9bb64ca7705c56a1a4ce3559ddb34b3680c526cb419"); /* ETH DID */ // Mainnet - ethereumDIDMainnetRecord.genesisBlockHeaderHash = - hashCreate ("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"); - + hashCreate ("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); ethereumDIDMainnetRecord.trustedCheckpointBlockHeaderHash = - hashCreate("0x04c2114a8cbe49ba5c37a03cc4b4b8d3adfc0bd2c78e0e726405dd84afca1d63"); + hashCreate("0x6afc2eb01956dfe192dc4cd065efdf6c3c80448776ca367a7246d279e228ff0a"); // Testnet / 'Ropsten' - ethereumDIDTestnetRecord.genesisBlockHeaderHash = hashCreate("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"); - ethereumDIDTestnetRecord.trustedCheckpointBlockHeaderHash = hashCreate("0x1b1ba890510e06411fdee9bb64ca7705c56a1a4ce3559ddb34b3680c526cb419"); // Rinkeby - ethereumDIDRinkebyRecord.genesisBlockHeaderHash = hashCreate("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"); - ethereumDIDRinkebyRecord.trustedCheckpointBlockHeaderHash = hashCreate("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"); // Prvnet - ethereumDIDPrvnetRecord.genesisBlockHeaderHash = hashCreate("0x44e11ae079dff7583e99c3cc623dd09ae2b6929a55650a13ab468aae1a47a62f"); - ethereumDIDPrvnetRecord.trustedCheckpointBlockHeaderHash = hashCreate("0x44e11ae079dff7583e99c3cc623dd09ae2b6929a55650a13ab468aae1a47a62f"); + /** + * HECO + */ + // Mainnet + ethereumDIDMainnetRecord.genesisBlockHeaderHash = + hashCreate ("0x5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144"); + ethereumDIDMainnetRecord.trustedCheckpointBlockHeaderHash = + hashCreate("0x5751d1772ebc82d52d19d96157bb3f13ca8417217e3c0913adf15f04eb4cb144"); + + // Testnet / 'Ropsten' + ethereumDIDTestnetRecord.genesisBlockHeaderHash = + hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + ethereumDIDTestnetRecord.trustedCheckpointBlockHeaderHash = + hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + + // Rinkeby + ethereumDIDRinkebyRecord.genesisBlockHeaderHash = + hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + ethereumDIDRinkebyRecord.trustedCheckpointBlockHeaderHash = + hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + + // Prvnet + ethereumDIDPrvnetRecord.genesisBlockHeaderHash = + hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + ethereumDIDPrvnetRecord.trustedCheckpointBlockHeaderHash = + hashCreate("0xb24b1124276b1250ad3b2c02623677bce3e76c1539f76dcdfe4c27ab991c1dad"); + // Notable RACE needsInitialization = 0; diff --git a/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.h b/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.h index 9ab994189..d0182a8fe 100644 --- a/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.h +++ b/ThirdParty/breadwallet-core/ethereum/blockchain/BREthereumNetwork.h @@ -92,10 +92,16 @@ extern const BREthereumNetwork ethereumMainnet; extern const BREthereumNetwork ethereumTestnet; extern const BREthereumNetwork ethereumRinkeby; extern const BREthereumNetwork ethereumPrvnet; + extern const BREthereumNetwork ethereumDIDMainnet; extern const BREthereumNetwork ethereumDIDTestnet; extern const BREthereumNetwork ethereumDIDRinkeby; extern const BREthereumNetwork ethereumDIDPrvnet; + +extern const BREthereumNetwork ethereumHecoMainnet; +extern const BREthereumNetwork ethereumHecoTestnet; +extern const BREthereumNetwork ethereumHecoRinkeby; +extern const BREthereumNetwork ethereumHecoPrvnet; #ifdef __cplusplus } #endif