sourcify icon indicating copy to clipboard operation
sourcify copied to clipboard

Add Harmony networks

Open ernestognw opened this issue 2 years ago • 7 comments

Fixes #645

Testnet is not added since I haven't found an API to get deployment tx hash given the contract address for testnet. If I found any or receive feedback from the Harmony team, I'll add them.

Also, I can't follow correctly how does the web3.eth.getTransaction points to the specified chain, should I add rpc endpoints to sourcify-chains.ts?

Contract

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) public {
        storedData = x;
    }

    function get() public view returns (uint) {
        return storedData;
    }
}

Metadata

{"compiler":{"version":"0.8.7+commit.e28d00a7"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"contracts/1_Storage.sol":"SimpleStorage"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"contracts/1_Storage.sol":{"keccak256":"0xfa79bfa0e9d7acbb32774a2228765441c93b1fda3eb717ea515bea50f83e26aa","license":"GPL-3.0","urls":["bzz-raw://f6b7cf35ca688a5ef9315575cdb2fdebb791d45a8a3edeaa962753909ccd24e7","dweb:/ipfs/QmYoekw8e8yYmBfCCHRsb3hZJ64iJ7sR5XF8W69m2ntMho"]}},"version":1}

Addresses

Mainnet Shard 0: 0xa57b5cf2f083219eb630d74712060feee6f098fe Mainnet Shard 1: 0x9faf6ae7aa8e882b216c4ef1af14008f2a8d13c0 Mainnet Shard 2: 0x9faf6ae7aa8e882b216c4ef1af14008f2a8d13c0 Mainnet Shard 3: 0x9faf6ae7aa8e882b216c4ef1af14008f2a8d13c0

ernestognw avatar Feb 08 '22 19:02 ernestognw

Is the Shard 3 RPC working?

curl --location --request POST "https://s3.api.harmony.one" \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0x9faF6AE7AA8E882b216C4EF1af14008f2a8D13C0",
    "0x2"
  ],
  "id": 1
}'

returns:

curl: (6) Could not resolve host: s3.api.harmony.one

kuzdogan avatar Mar 10 '22 09:03 kuzdogan

@ernestognw bringing this up. The RPC still seems unavailable

kuzdogan avatar Apr 05 '22 13:04 kuzdogan

Hey @kuzdogan sorry for the delay, I missed the old message.

Sure, it's working, is just that you're pointing to a wrong URL, here's the official RPC endpoints:

  • https://api.s0.t.hmny.io/
  • https://api.s1.t.hmny.io/
  • https://api.s2.t.hmny.io/
  • https://api.s3.t.hmny.io/
> curl --location --request POST "https://api.s3.t.hmny.io" \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0x9faf6ae7aa8e882b216c4ef1af14008f2a8d13c0",
    "latest"
  ],
  "id": 1
}'

> {"jsonrpc":"2.0","id":1,"result":"0x608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b6100556004803603810190610050919061009d565b610075565b005b61005f61007f565b60405161006c91906100d9565b60405180910390f35b8060008190555050565b60008054905090565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a9c5369928359c2b2c0534afc63bfd43a98e74d6fca5debaabea8690eb7101964736f6c63430008070033"}

ernestognw avatar Apr 06 '22 02:04 ernestognw

@ernestognw I see. Then these need to be updated in the https://chainid.network/chains.json as well (ethereum-lists/chains) we are using that file for public RPCs. This is also used by many services such as https://chainlist.org.

Could you please ping the devs about this?

kuzdogan avatar Apr 06 '22 07:04 kuzdogan

@ernestognw I see. Then these need to be updated in the https://chainid.network/chains.json as well (ethereum-lists/chains) we are using that file for public RPCs. This is also used by many services such as https://chainlist.org/.

Could you please ping the devs about this?

Thanks for the heads up, I opened a PR, let's see if this is merged https://github.com/ethereum-lists/chains/pull/1061

ernestognw avatar Apr 07 '22 19:04 ernestognw

Just approved and merged @kuzdogan

https://github.com/ethereum-lists/chains/pull/1061

ernestognw avatar Apr 08 '22 15:04 ernestognw

Can you also provide test contracts for each network (with source code and metadata)? They can be easily deployed via the deploy script as described in docs but since these are all mainnets I guess that's not possible.

Tests will be added to chain-tests.js and run regularly to check RPC availability and verification.

kuzdogan avatar Apr 12 '22 08:04 kuzdogan

hey @ernestognw do you have news about this?

marcocastignoli avatar Oct 24 '22 15:10 marcocastignoli

I'm closing this for inactivity

marcocastignoli avatar Nov 08 '22 09:11 marcocastignoli