Go-Ethereum
如何使用 admin.addPeer() 命令從我的同步 geth 節點創建對等節點列表以手動粘貼到我的非同步 geth 節點?
我有一個未同步到乙太坊網路的乙太坊節點。引導節點可能存在一些問題 - 請參閱geth 沒有開箱即用同步。
如何從我的同步節點輕鬆創建對等節點列表,以便我可以將
admin.addPeer(...)
命令列表複製並粘貼到我的非同步節點中?
在同步節點中執行以下命令以創建
admin.addPeer(...)
可以粘貼到非同步節點的命令列表:function getPeers() { admin.peers.forEach( function(e) { console.log("admin.addPeer('enode://" + e.id + "@" + e.network.remoteAddress.substring(0, e.network.remoteAddress.indexOf(':')) + ":30303');"); }) } getPeers();
執行上面的命令將創建以下
admin.addPeer(...)
命令列表,您可以將這些命令粘貼到您的geth console
或geth attach
命令行中以啟動非同步 geth 節點同步:admin.addPeer('enode://102f67188f247917f7961ccd073f41f969e071beef3161de81b64a2b438a5a551b1b6bf878838cdaa1ffad7b30a701f9b66cd407dd3f749725f2580979a6d814@223.72.84.91:30303'); admin.addPeer('enode://1263b51754fc03be5800469078218318c43a07dfa53405794d12f77ee72a0ff49b48c86ebae501ef239d4a9253cc8dc6a889acdbb33176bc3e1bd4a499d4bc48@139.59.214.200:30303'); admin.addPeer('enode://1f02c248c72b724fc3e80bf2acd31f2fe1a06eb9695721e0b4c93b84ec85ded701ea24c6c6be5774cbb033f1757daa45f93cdc0c44130e1eca22281ff817d886@91.121.137.85:30303'); admin.addPeer('enode://217cf940322c5f845ce26df56e127db69acc49068c7048c11fb0915db786d97576fedf69194f4b253917eb0283c30d6afee91a187f5171b166051608d429f6e3@73.228.64.242:30303'); admin.addPeer('enode://25f367ada5f383f26522c1987274aeb06d40f37dbcaf3a896e9246b7b0355e03a890bea7486f8c30638ede31cb50d41b932c99e2c6e93e70fb02f8910896a33f@212.129.4.178:30303'); admin.addPeer('enode://2bee4f004230f2b2cfa1d7aed19b8bc0b04332cb027f383ee47478cd9b3e6fb5e2ac2dccdb471cd424c7767dcd66a9cd806d48c34c2aa00b45902cb0be686f54@194.107.234.50:30303'); admin.addPeer('enode://41fcd2e1d3d14f3ae5578b1675f8e7730fa3f240df320af0f87ae9706bbcc22cee30b4e840ed32ed1f2a45308122250116468efa80de7bf31aae0d18374f9870@45.33.18.55:30303'); admin.addPeer('enode://47fc7ce8b0e3a5729b2ab3b36e3f74c81386a684f98634db69cde8d0484cce9fa40fb62efd753e4b30d8b6ef9ea1517a54d31cfa6c17e156dc5e2b25b3a3b86f@31.48.161.35:30303'); admin.addPeer('enode://4969793b57321989c6225860decbee28a1a616437af0f2a7a2dd0cf2f24bf5a2149b1976e3826619838bf8b2f1b05eff2df142f8581c77fc5956c31ea98c013b@163.47.16.147:30303'); admin.addPeer('enode://4ed7b3416dee89af1fc3d495538f3a8b2350cd5998c35352af160ab7b09781ab09d858b3d5008e36081aa96e79f1d19e7ef39afc5c7c6c0473e5a358bd7ae446@176.11.213.78:30303'); admin.addPeer('enode://5503a014bf6319df54a1b4e10fc714471bbc5f5bc5bcc718c7a82d170aad7647fde3729fad0fa118070ef78f3f747777e3eb39deeb927d4ded57c152449657de@95.27.168.118:30303'); admin.addPeer('enode://5c968fc1ac2974cbe845010a3e2455481754aa6d0268a79058945fb38a9b9c2cde3017be6e63f4d81e7ed869d6bf5f97c0c21a825cd577e63b8d85debf1207b3@115.145.210.119:30303'); admin.addPeer('enode://638bda89f0ec27eb4084c6fca9612267f30feb50fa0e6c89ccb590520e79d93db926bd2820a2a8501976845aea31d698779036f73cb352fea26cd5b7c1fd5800@175.141.2.52:30303'); admin.addPeer('enode://8c929650931eeb299eaf5e9bde3366769063e7792d5e5dbbebb441834b9d3f16a883bf4a62f3d2ec97abecc855981f5cd3fd55b7d3b019fda4d150c5e430c0b2@89.142.250.197:30303'); admin.addPeer('enode://928ac28c4423f01b039b197df3750b9694d9633dd27698163fe40531c077f153cb18202e088fa39397bf65229bcbbc0669bf9cc59e1564e8a83d8582bae1c9e1@74.105.54.35:30303'); admin.addPeer('enode://9846258b06e1ceabfb07306dd25f580a0075d300357798e81d6c9924ed056d2d0bf4ec71fb3d21e4ce8c6cad8a3b04347ea186f0a221fc5df34aacf45751d606@82.226.188.209:30303'); admin.addPeer('enode://99da4a25a37faf8eb33919e0d3c73e72d47f6dc5bc4b31792ccd846f6ba8aebd4b43242edc426fa623c11020a1893dafaebd519d5cdc70f816f58c3b89cc8004@138.201.60.198:30303'); admin.addPeer('enode://9e8e18f87f7d9243ae0e5f0e91e370be8b7b5ee752428908f63a54d98daf929e10d3d0207c48ff4d227634789731cfe71fcc4d721ac2c29fdf3da5d1cd020830@148.75.217.16:30303'); admin.addPeer('enode://a7625fabd2fb8c5beb615470892dbeccd47abe17cba570ed563c27811b84189222776019bf8952ccad499136884ad84ee67f5aaf2d39be15eef5261647c87777@204.44.71.193:30303'); admin.addPeer('enode://bc48b9ad389ce99f5f27807c83dc5708bad61cc1deb5526729ec19abb0c8b6b971f811b94aedbd5a9d23d380a22590b77fb23a477cbd138e5ac8ad028d00fcae@77.198.202.84:30303'); admin.addPeer('enode://c602f69626e00e9398bb4704d659a9ee7b1a5d1a0a513da0392bcb8c218476ceabc50ebf7548aaab75c504ae87f1577c23aa921091fa2c406a7b7e91e454b9b7@179.181.94.248:30303'); admin.addPeer('enode://cd6611461840543d5b9c56fbf088736154c699c43973b3a1a32390cf27106f87e58a818a606ccb05f3866de95a4fe860786fea71bf891ea95f234480d3022aa3@136.243.154.245:30303'); admin.addPeer('enode://dac58e4aa689a44e907468a767549e9d40e826047f341d7f48bd511035a4c0277c27194a36b437056da4a1070887bf8c230152b03f45eb83f3fd7c51300d65ef@108.90.22.140:30303'); admin.addPeer('enode://df2176d6f24e3ae30973e21d53ba24307c1b6a2adeffc1028b00f78e7039923e0925539a1a931a86c6e29f3dcd2453c8671d3bba334674aeeec5f1dca9de8f13@193.77.124.226:30303'); admin.addPeer('enode://ebd81524f0a1f7222b5516dc04a5f13d75677a018e52ad6450632a01a832b80af0e932b6f87fc4ab48bef57dbfcba34217d68f76d01519034f4a82d283cbe4bb@193.192.36.230:30303'); // Paste the above lines into your non-syncing geth node command line
該腳本替換對等方的埠,以
30303
假設這是連接的對等方正在偵聽的埠。其中有些是正確的,有些則不是。但這足以啟動您的節點同步。
geth
這是我的另一個同步節點的另一個列表:admin.addPeer('enode://02c7a9f857e89b69835083d4bbb091a3d8c05689d0cc92c5de7e40bb4085243f72d8911c452d1874f17b7545307d69cc7f11117c8a052b56ac20fd34bfffa6a7@78.142.19.33:30303'); admin.addPeer('enode://168cd8834fe70e5144de8f14a700cd46b338ccd7d1f4e35910f9383ec459b992435cc65995a44c3edd5013b1543bc06af9df786224292bcb278e1a965403dbf3@217.225.51.148:30303'); admin.addPeer('enode://247674aba9b05514bfebfb7ceae4d8cc02a2a1b428747d5944b07cc8228aef381ba43bb4f0fac6d4ab20d6051e067f62e1f4262674767c8d817ac395459534d7@213.239.217.18:30303'); admin.addPeer('enode://5b9ef01d1749b066561df35fc3faf652a3a95d708accd6586879ae6ee0887599af4ea1b037e0d550d299a0da326fb412ea3b1ab7108198a0381912cc7ab13abc@50.79.174.252:30303'); admin.addPeer('enode://63eb7d27c0e974ad2545c527b7b1786a4f00b952ece830bb0dfc11756f56e007e50005c678bbdf8685b8318dc4a50ac47768596bc50bb76a2a590ea018daa126@37.139.1.12:30303'); admin.addPeer('enode://6f7da54f6ba4a3a3339a06c71ba33abbdf61914bdf709a24d18630d7faa7cd2b68312ddd035eaa03d8e90dca830a59f194a10440f19dba5cd71ce22188b4f6ee@23.239.23.94:30303'); admin.addPeer('enode://c13ee7b82fd3898d1b9c5af1c38356a06cee0a9c7312a431f17dbfadc900ff972a3693e5a0155d4709b0595485f16f37984ab355cdc168ac45bfccee85155534@101.201.55.150:30303'); admin.addPeer('enode://cd92463a7c40e97b9295734b3c8f8d988017a8b44dc0d2595f317d3325d9b21ae47f47f800cfb064c8761012f188b1f966199bd528875c265d324f68a7a82594@198.20.71.28:30303'); admin.addPeer('enode://ed4227681ca8c70beb2277b9e870353a9693f12e7c548c35df6bca6a956934d6f659999c2decb31f75ce217822eefca149ace914f1cbe461ed5a2ebaf9501455@88.212.206.70:30303'); admin.addPeer('enode://ed9e98ce65f027b5d3f0d3854e45ea44540aa25f3701bf46e0d3050113335ebeb2a9d51866d1c07c443979c75182633ead7cf50f040f9dd61add8b21370720f3@207.6.120.30:30303'); admin.addPeer('enode://f3a209405a09163e593ac0be5ee0d5cefbf6d688a28f794062fc281706f0401eb1fa10ab0494a6c91fc7469192cc936082d51b280d70c0b1d2f51ddf0a4c693b@89.143.58.76:30303'); admin.addPeer('enode://fa2c17dcc83a6e2825668210abf7480452de4b13d8bdea8f301c3b603701918bc4dade9e68d119d7a8214e90e7ea10a2782041c98951385d97bee73358fb08f4@120.26.124.58:30303'); admin.addPeer('enode://ff8329ab6e4b09a4f60b732b0a97a7b4c77d3a563305deb57a2e9244ee030ba0974108d9a6144e993e2df74b07572966e846f5f0d60d26cca75cf1361290c8af@76.6.94.199:30303');
我重新啟動了我的一個同步
geth
節點,並在下面有另一個對等節點列表:admin.addPeer('enode://02c7a9f857e89b69835083d4bbb091a3d8c05689d0cc92c5de7e40bb4085243f72d8911c452d1874f17b7545307d69cc7f11117c8a052b56ac20fd34bfffa6a7@78.142.19.33:30303'); admin.addPeer('enode://247674aba9b05514bfebfb7ceae4d8cc02a2a1b428747d5944b07cc8228aef381ba43bb4f0fac6d4ab20d6051e067f62e1f4262674767c8d817ac395459534d7@213.239.217.18:30303'); admin.addPeer('enode://27020b58ee512408bbe18e86a42001fdc677a18b507a4f1a62c926aae40cfb7db3d866d771c55400375bf42a05c1f3e1b67bc8bb9c1f2a620c06de87b6341e1a@76.8.211.175:30303'); admin.addPeer('enode://4cd540b2c3292e17cff39922e864094bf8b0741fcc8c5dcea14957e389d7944c70278d872902e3d0345927f621547efa659013c400865485ab4bfa0c6596936f@138.201.144.135:30303'); admin.addPeer('enode://52f1543d480a111d367ba8c43bef2dff700e32da728ae915be1744fdf71a51c3bb1cdde324c64ef37f345eb0b665bf2510f57ce598572afdcfdfa1996f31e854@188.191.97.234:30303'); admin.addPeer('enode://5b9ef01d1749b066561df35fc3faf652a3a95d708accd6586879ae6ee0887599af4ea1b037e0d550d299a0da326fb412ea3b1ab7108198a0381912cc7ab13abc@50.79.174.252:30303'); admin.addPeer('enode://63eb7d27c0e974ad2545c527b7b1786a4f00b952ece830bb0dfc11756f56e007e50005c678bbdf8685b8318dc4a50ac47768596bc50bb76a2a590ea018daa126@37.139.1.12:30303'); admin.addPeer('enode://6f7da54f6ba4a3a3339a06c71ba33abbdf61914bdf709a24d18630d7faa7cd2b68312ddd035eaa03d8e90dca830a59f194a10440f19dba5cd71ce22188b4f6ee@23.239.23.94:30303'); admin.addPeer('enode://8cca25d44598cec36cd6acdb23c36155b3ee4f503bab1c7ed843e0482dcb6efd829ce4560635553f2d260e9c93ba1b0287be3650230e39dfedda7ee1235becbf@198.204.224.106:30303'); admin.addPeer('enode://bbe3a82f923e029ac51bb7bf92c989ec3ed42e250404682968bc3ababdc145623e333d61fee80e53f5badd26eb78b6c12ff92cf5d88e8da331fba88b1ff96e34@149.202.94.198:30303'); admin.addPeer('enode://db9be59a8362cfb91579af9e5f5bcd4e33d33c54d65ebab694644ea933d0b9f2b0c4fd5aa9ea271a2809a34d7e5190c0da042acf9c329648d27b898db00d7378@176.104.190.181:30303'); admin.addPeer('enode://f1e0239377152ce45d173217fdd565d0bb77060f424b2e32b69c8ee84fce15eacae284ad9a3ec55d104b8ce982e25f2411fd307b9dd15b132215c64bea4ebb49@51.7.61.89:30303'); admin.addPeer('enode://ff16225df39f309b5dd0d3e335f9b3a0aca2676797c1c7294f03d4afec04af0a6091a838846d0ff6eb35b5cf32853a2d234734641aa21a7268d00505fe4f2cca@95.31.209.98:30303');
我期待下一個版本
geth
修復了這個問題。有關將這些行插入OS/X、Windows 和 Linux的或命令的說明,請參閱Reddit - 乙太坊錢包
geth
客戶端不同步 - Bootnodes 可能存在的問題。admin.addPeer(...)``geth attach``geth console