Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devp2p ,Does it support BSC networks? #1394

Closed
myuniswap2000 opened this issue Aug 6, 2021 · 19 comments
Closed

devp2p ,Does it support BSC networks? #1394

myuniswap2000 opened this issue Aug 6, 2021 · 19 comments

Comments

@myuniswap2000
Copy link

hello, amin, everyone!
1,devp2p ,Does it support BSC networks?
2, I run /packages/devp2p/examples/peer-communication.ts:
node -r ts-node/register ./examples/peer-communication.ts:
but, it is error:
Peer error1 (18.176.58.248:30311): Genesis block mismatch: d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3 / 0d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5b
Remove peer: 18.176.58.248:30311 - peer disconnect, reason: SUBPROTOCOL_ERROR (16) (total: 1)
3,i add bsc conf is : import bsc.json
const common = new Common({ chain: bsc });

4, thank you !!

@myuniswap2000
Copy link
Author

my version is @ethereumjs/[email protected] , thank you .

@myuniswap2000
Copy link
Author

other error is:
[

Peer error1 (135.125.219.7:30303): NetworkId mismatch: 38 / d74c
Remove peer: 135.125.219.7:30303 - peer disconnect, reason: SUBPROTOCOL_ERROR (16) (total: 1)

]

@myuniswap2000
Copy link
Author

2, other error:
Peer error1 (35.73.137.11:30311): Genesis block mismatch: d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3 / 0d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5b

@myuniswap2000
Copy link
Author

3, other info:
Remove peer: 35.73.137.11:30311 - peer disconnect, reason: SUBPROTOCOL_ERROR (16) (total: 0)
Total nodes in DPT: 1, open slots: 25, queue: 0 / 0
Add peer: 167.99.162.43:30305 Geth/v1.5.0-EthoProtocol--Atlas/linux-amd64/go1.14.15 (eth66) (total: 1)
Remove peer: 167.99.162.43:30305 - peer disconnect, reason: SUBPROTOCOL_ERROR (16) (total: 0)
Add peer: 52.231.165.108:30303 Geth/v1.10.4-unstable-017cf71f-20210525/linux-amd64/go1.16.4 (eth66) (total: 1)
DPT error: Error: Peer is banned
DPT error: Error: Peer is banned
DPT error: Error: Peer is banned
Peer error1 (52.231.165.108:30303): NetworkId mismatch: 38 / 01

@acolytec3
Copy link
Contributor

I know @srgl was able to get it working (see comments in this issue. We don't actively support BSC but it looks like it should work based on this previous issue. @srgl, any chance you could share the common configuration you used to get BSC working?

@srgl
Copy link

srgl commented Aug 6, 2021

I am using the following common object:

new Common({
    "chain": {
      "name": "mainnet",
      "chainId": 56,
      "networkId": 56,
      "defaultHardfork": "istanbul",
      "consensus": {
        "type": "pow",
        "algorithm": "ethash",
        "ethash": {}
      },
      "comment": "The Ethereum main chain",
      "url": "https://ethstats.net/",
      "genesis": {
        "hash": "0x0d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5b",
        "timestamp": null,
        "gasLimit": 40000000,
        "difficulty": 1,
        "nonce": "0x0000000000000000",
        "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
        "stateRoot": "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"
      },
      "hardforks": [
        {
          "name": "chainstart",
          "block": 0,
          "forkHash": "0xfc64ec04"
        },
        {
          "name": "homestead",
          "block": 1150000,
          "forkHash": "0x97c2c34c"
        },
        {
          "name": "dao",
          "block": 1920000,
          "forkHash": "0x91d1f948"
        },
        {
          "name": "tangerineWhistle",
          "block": 2463000,
          "forkHash": "0x7a64da13"
        },
        {
          "name": "spuriousDragon",
          "block": 2675000,
          "forkHash": "0x3edd5b10"
        },
        {
          "name": "byzantium",
          "block": 4370000,
          "forkHash": "0xa00bc324"
        },
        {
          "name": "constantinople",
          "block": 7280000,
          "forkHash": "0x668db0af"
        },
        {
          "name": "petersburg",
          "block": 7280000,
          "forkHash": "0x668db0af"
        },
        {
          "name": "istanbul",
          "block": 9069000,
          "forkHash": "0xfc3ca6b7"
        }
      ],
      "bootstrapNodes": [
        {
          "ip": "52.71.43.172",
          "port": 30311,
          "id": "1cc4534b14cfe351ab740a1418ab944a234ca2f702915eadb7e558a02010cb7c5a8c295a3b56bcefa7701c07752acd5539cb13df2aab8ae2d98934d712611443",
          "location": "ap-southeast-1-001",
          "comment": "bootnode-aws-ap-southeast-1-001"
        },
        {
          "ip": "34.246.65.14",
          "port": 30311,
          "id": "28b1d16562dac280dacaaf45d54516b85bc6c994252a9825c5cc4e080d3e53446d05f63ba495ea7d44d6c316b54cd92b245c5c328c37da24605c4a93a0d099c4",
          "location": "us-east-1-001",
          "comment": "bootnode-aws-us-east-1-001"
        },
        {
          "ip": "35.73.137.11",
          "port": 30311,
          "id": "5a7b996048d1b0a07683a949662c87c09b55247ce774aeee10bb886892e586e3c604564393292e38ef43c023ee9981e1f8b335766ec4f0f256e57f8640b079d5",
          "location": "eu-west-1-001",
          "comment": "bootnode-aws-eu-west-1-001"
        }
      ],
      "dnsNetworks": [
        "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net"
      ]
    }
  }

Also replace checkblock parameters in peer-communication.ts according to bsc chain.

@myuniswap2000
Copy link
Author

thank you

@myuniswap2000
Copy link
Author

I know @srgl was able to get it working (see comments in this issue. We don't actively support BSC but it looks like it should work based on this previous issue. @srgl, any chance you could share the common configuration you used to get BSC working?

hi,@ thank you for hlep me!
(1)i conf is like @srgl .
(2)but, run peer-communication.ts:
i have many erro is :
DPT error: Error: Peer is banned
DPT error: Error: Peer is banned
(3)and have not receive TX!
please help me!

@myuniswap2000
Copy link
Author

hi,@srgl thank you for hlep me!
(1)i conf is like above.
(2)but, run peer-communication.ts:
i have many erro is :
DPT error: Error: Peer is banned
DPT error: Error: Peer is banned
(3)and have not receive TX!
please help me!

@srgl
Copy link

srgl commented Aug 6, 2021

You can ignore peer ban errors. What TX are you trying to receive?

@myuniswap2000
Copy link
Author

in addition,
Do I need to configure "genesisStates" ?

@myuniswap2000
Copy link
Author

I need to receive new block and tx

@myuniswap2000
Copy link
Author

i have not find checkblock param ...

@srgl
Copy link

srgl commented Aug 6, 2021

You need to correct these lines according to the bsc:

const CHECK_BLOCK_TITLE = 'Berlin Fork' // Only for debugging/console output
const CHECK_BLOCK_NR = 12244000
const CHECK_BLOCK = '1638380ab737e0e916bd1c7f23bd2bab2a532e44b90047f045f262ee21c42b21'
const CHECK_BLOCK_HEADER = rlp.decode(
Buffer.from(
'f90219a0d44a4d33e28d7ea9edd12b69bd32b394587eee498b0e2543ce2bad1877ffbeaca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941ad91ee08f21be3de0ba2ba6918e714da6b45836a0fdec060ee45e55da9e36060fc95dddd0bdc47e447224666a895d9f0dc9adaa0ca0092d9fcc02ca9b372daec726704ce720d3aa366739868f4820ecaabadb9ac309a0974fee017515a46303f467b6fd50872994db1b0ea64d3455bad93ff9678aced9b90100356050004c5c89691add79838a01d4c302419252a4d3c96e9273908b7ee84660886c070607b4928c416a1800746a0d1dbb442d0baf06eea321422263726748600cc200e82aec08336863514d12d665718016989189c116bc0947046cc6718110586c11464a189000a11a41cc96991970153d88840768170244197e164c6204249b9091a0052ac85088c8108a4418dd2903690a036722623888ea14e90458a390a305a2342cb02766094f68c4100036330719848b48411614686717ab6068a46318204232429dc42020608802ceecd66c3c33a3a1fc6e82522049470328a4a81ba07c6604228ba94f008476005087a6804463696b41002650c0fdf548448a90408717ca31b6d618e883bad42083be153b83bdfbb1846078104798307834383639373636353666366532303530366636663663a0ae1de0acd35a98e211c7e276ad7524bb84a5e1b8d33dd7d1c052b095b564e8b888cca66773148b6e12',
'hex'
)
)

@srgl
Copy link

srgl commented Aug 6, 2021

Sorry, I do not have a code, but you can use any block number/hash from the chain.

@myuniswap2000
Copy link
Author

Sorry, I do not have a code, but you can use any block number/hash from the chain.
1,
ok, thank you very much!
2,
Has the data message of BSC changed? Do you have relevant information about the code I want to modify? I'm not proficient in geth. thank you

@myuniswap2000
Copy link
Author

I succeeded. I got TX. Thank you very much for your help. I wish you have a nice day!
💯 🥇 👍

@bpbogdanpop
Copy link

@srgl @myuniswap2000 I'm still not sure what should I use for CHECK_BLOCK_HEADER? I already took the number and hash of a block from BSC. But where do I get that CHECK_BLOCK_HEADER Buffer hex string from?

@ryanio
Copy link
Contributor

ryanio commented May 25, 2022

I'm still not sure what should I use for CHECK_BLOCK_HEADER? I already took the number and hash of a block from BSC. But where do I get that CHECK_BLOCK_HEADER Buffer hex string from?

@bpbogdanpop That is the block RLP for the Berlin hardfork block (as an example). If you want to replace it with another block, you can request it from the peer and console.log their payload output (with toString('hex') on the buffer to get a nice copy and paste value), and replace it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants