目录
环境
想法
- 由于挖矿很费性能,对于手上的垃圾服务器来说,要挂nginx和tomcat还要挖矿实在是难为它了。
- 因此想把挖矿的任务分给另一台服务器。
- 目标效果即为:
- 副节点连上主节点,两者的数据同步。
- 主节点关闭挖矿,节省性能,由副节点挖矿。
开搞
让副节点连上主节点
- 注意:
- 不要在副节点上直接打开geth执行
- $ geth attach http://your_ip:8545
- 这样相当于远程连接控制主节点了,就像我们在windows上用ssh远程连接linux去控制geth挖矿的开启和关闭一样,链上仍然只有主节点一个,只不过有主节点本机和另一台机可以去控制主节点。
- 不要在副节点上直接打开geth执行
- 副节点需要和主节点用一样的创世块文件
- 这里就用和之前的文章(以太坊私链搭建)所用的创世块一致
- genesis.json
{
"config":{
"chainId":7,
"homesteadBlock":0,
"eip150Block":0,
"eip155Block":0,
"eip158Block":0,
"byzantiumBlock":0,
"constantinopleBlock":0,
"petersburgBlock":0,
"istanbulBlock":0,
"ethhash":{}
},
"alloc":{},
"coinbase":"0x0000000000000000000000000000000000000000",
"difficulty":"0x2",
"extraData":"",
"gasLimit":"0xffffffff",
"nonce":"0x0000000000000042",
"mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp":"0x00"
}
- 还要准备启动脚本,这里也保持和主节点一致
- rungeth.sh
geth --datadir ./data --networkid 7 --http --http.addr 0.0.0.0 --http.vhosts "*" --http.api "admin,debug,web3,eth,txpool,personal,ethash,miner,net" --http.corsdomain "*" --snapshot --mine --miner.threads 1 --allow-insecure-unlock console 2> 1.log
- 在副节点所在机新建一个用户
- $ geth --datadir ./data account new
- 然后在副节点所在机初始化创世块
- $ sudo geth --datadir ./data init ./genesis.json
- 启动geth
- $ sudo ./rungeth.sh
- 如果是在一台机子上搞两个节点,则要修改他们的运行端口,使之不要重复,不然其中一个会启动不起来。
- 至此,副节点就部署完成了,接下来要在主节点中添加副节点。
- 首先查看一下副节点的enode
- > admin.nodeInfo.enode
- 首先查看一下副节点的enode
- -
- 在主节点添加副节点的enode
- >admin.addPeer("encode")
- 在主节点添加副节点的enode
- 查看是否添加成功
- 方法1:
- 直接对比两者的块高度看看是否相等,如果块比较多,可能需要等待一下同步。
- > eth.blockNumber
- 方法2:
- net.peerCount
- admin.peers
- 方法1:
- 让副节点代替主节点挖矿
- 把主节点挖矿停掉,在主节点所在机执行:
- > miner.stop()
- 让副节点挖矿,在副节点所在机执行:
- > miner.start()
- 把主节点挖矿停掉,在主节点所在机执行:
修改java程序连接副节点
- 上一篇的文章:java使用web3j调用以太坊私链上的智能合约
- 上文中讲到,java程序连接单节点(主节点)的私链去调用智能合约。
- 注意:
- 如果不修改的话,此时主节点虽然开着geth,但关闭了挖矿,只能和副节点进行数据同步,而连接主节点发送的请求都是不能执行的。
- 而且主节点的geth不能关闭,否则副节点也会出问题。
- 不要在开着geth的时候直接关闭ssh窗口,否则会导致链的数据丢失,要在geth里执行> exit 退出。
- 复制副节点的用户私钥文件到java程序执行的机子上,
- 修改java程序使用这个私钥文件,并把用户地址也改成这个私钥文件的用户。
- 修改java程序连接副节点所在的服务器ip地址。
- 到这里就可以了,如此就实现了让副节点代替主节点挖矿的任务了。
存在的问题
- 主节点的账号是不能在连接副节点后使用的,也就是说,两个节点实际上只有链上的数据是互通的,账号是不互通的。因此java程序连接副节点时需要修改。
- 此时主节点只能同步数据,不能挖矿,连接到主节点后发送的交易并不会由副节点代替挖矿完成。
Great post! We will be linking to this great article on our site. Keep up the good writing.
http://nolvadexbestprice.pro/# does tamoxifen cause menopause
Excellent post. I am going through many of these issues as well..
Very good post. I will be facing many of these issues as well..
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 hyperlinks with inclusion within articles on article platforms
Secondary – 3000 URL Forwarded hyperlinks
Tertiary – 20000 hyperlinks assortment, remarks, articles
Implementing a link network is useful for indexing systems.
Necessitate:
One reference to the platform.
Query Terms.
Valid when 1 key phrase from the page heading.
Highlight the additional service!
Important! Tier 1 links do not overlap with Tier 2 and 3rd-level connections
A link network is a device for elevating the liquidity and backlink portfolio of a internet domain or online community
Pretty! This has been a really wonderful post. Many thanks for supplying this info.
prednisone 5 mg tablet: prednisone 40 mg price – prednisone 80 mg daily
Link pyramid, tier 1, tier 2, tier 3
Top – 500 links with inclusion contained in pieces on writing domains
Secondary – 3000 domain Redirected hyperlinks
Lower – 20000 hyperlinks combination, feedback, writings
Using a link structure is beneficial for indexing systems.
Necessitate:
One hyperlink to the domain.
Search Terms.
True when 1 search term from the website title.
Note the supplementary offering!
Vital! Primary connections do not conflict with Tier 2 and Tier 3-tier references
A link network is a tool for enhancing the movement and link profile of a digital property or social media platform
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 hyperlinks with inclusion embedded in articles on article sites
Level 2 – 3000 URL +Redirect references
Tertiary – 20000 connections blend, comments, writings
Using a link pyramid is beneficial for search engines.
Demand:
One hyperlink to the platform.
Search Terms.
Accurate when 1 keyword from the content subject.
Note the extra feature!
Important! Primary links do not coincide with Secondary and 3rd-level hyperlinks
A link hierarchy is a mechanism for increasing the circulation and backlink portfolio of a digital property or online community
Link pyramid, tier 1, tier 2, tier 3
Top – 500 hyperlinks with positioning contained in writings on article portals
Level 2 – 3000 URL Forwarded links
Lower – 20000 references combination, comments, posts
Implementing a link hierarchy is advantageous for online directories.
Need:
One connection to the domain.
Search Terms.
True when 1 keyword from the website heading.
Note the extra service!
Essential! First-level links do not conflict with Tier 2 and Tertiary-tier connections
A link hierarchy is a tool for boosting the liquidity and link profile of a website or social network
Link pyramid, tier 1, tier 2, tier 3
Tier 1 – 500 references with positioning inside pieces on content domains
Level 2 – 3000 web address Rerouted links
Level 3 – 20000 links mix, posts, entries
Utilizing a link hierarchy is useful for web crawlers.
Need:
One reference to the platform.
Key Phrases.
Valid when 1 search term from the content heading.
Note the extra offering!
Important! Primary references do not intersect with 2nd and Tier 3-level connections
A link hierarchy is a tool for boosting the movement and backlink portfolio of a website or online community
prednisone online australia: prednisone 5 tablets – no prescription online prednisone
You ought to be a part of a contest for one of the best websites on the net. I am going to highly recommend this website!
https://nolvadexbestprice.pro/# nolvadex during cycle
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 links with placement contained in pieces on article portals
Level 2 – 3000 URL Forwarded connections
Tertiary – 20000 references combination, posts, posts
Using a link pyramid is useful for web crawlers.
Require:
One link to the site.
Query Terms.
True when 1 keyword from the website title.
Highlight the extra feature!
Vital! Top references do not coincide with Secondary and Tertiary-rank hyperlinks
A link hierarchy is a tool for enhancing the flow and inbound links of a website or virtual network
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 references with placement embedded in pieces on writing portals
Level 2 – 3000 URL +Redirect links
Tertiary – 20000 hyperlinks mix, feedback, posts
Using a link structure is helpful for web crawlers.
Need:
One reference to the website.
Keywords.
Accurate when 1 search term from the content heading.
Observe the additional service!
Crucial! Tier 1 hyperlinks do not intersect with Secondary and Tertiary-level references
A link network is a instrument for elevating the circulation and referral sources of a digital property or social network
buy cytotec over the counter: buy cytotec in usa – buy cytotec pills
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 hyperlinks with integration embedded in writings on writing platforms
Secondary – 3000 link Rerouted connections
Tier 3 – 20000 links mix, posts, articles
Utilizing a link pyramid is helpful for online directories.
Demand:
One link to the platform.
Search Terms.
True when 1 query term from the website subject.
Highlight the supplementary feature!
Vital! Tier 1 links do not conflict with 2nd and Tertiary-level hyperlinks
A link structure is a mechanism for boosting the flow and inbound links of a digital property or social media platform
propecia generic: get generic propecia pill – buy cheap propecia online
where to buy nolvadex who should take tamoxifen does tamoxifen cause bone loss
Link pyramid, tier 1, tier 2, tier 3
Top – 500 links with inclusion contained in writings on writing platforms
Tier 2 – 3000 domain +Redirect references
Tertiary – 20000 hyperlinks combination, remarks, posts
Using a link hierarchy is advantageous for search engines.
Need:
One hyperlink to the domain.
Query Terms.
Valid when 1 search term from the website heading.
Highlight the supplementary offering!
Vital! Primary hyperlinks do not conflict with Secondary and 3rd-order references
A link network is a tool for increasing the flow and referral sources of a website or social network
buying generic propecia online: cost propecia – cost of propecia without insurance
http://zithromaxbestprice.pro/# zithromax online
Misoprostol 200 mg buy online buy cytotec online Cytotec 200mcg price
http://prednisonebestprice.pro/# prednisone 2.5 mg tab
tamoxifen breast cancer: hysterectomy after breast cancer tamoxifen – what happens when you stop taking tamoxifen
http://cytotecbestprice.pro/# cytotec pills buy online
As of August 2019, they have aggregated 30 million customers and that number excludes many popular markets like China and India.
Contracts may be spread against different months or different markets using a calendar effect.
prednisone price canada purchase prednisone canada prednisone 5mg price
https://propeciabestprice.pro/# cheap propecia tablets
Cytotec 200mcg price: Abortion pills online – cytotec online
Thank you for great information. Hello Administ . Seo Paketi Skype: By_uMuT@KRaLBenim.Com -_- live:by_umut
prednisone 50 mg coupon prednisone 5mg cost cheap prednisone online
Aw, this was an extremely good post. Finding the time and actual effort to make a really good article… but what can I say… I put things off a lot and don’t seem to get nearly anything done.
The writing has the warmth and familiarity of a favorite sweater, providing comfort and insight in equal measure.
https://zithromaxbestprice.pro/# zithromax for sale 500 mg
Right here is the perfect web site for anyone who wants to understand this topic. You know so much its almost tough to argue with you (not that I really will need to…HaHa). You definitely put a brand new spin on a subject which has been discussed for a long time. Excellent stuff, just great.
There’s certainly a lot to learn about this issue. I like all of the points you’ve made.
http://prednisonebestprice.pro/# buy prednisone without prescription paypal
Abortion pills online: cytotec abortion pill – cytotec online
You’ve made some decent points there. I looked on the net for more info about the issue and found most people will go along with your views on this website.
buy cytotec over the counter Cytotec 200mcg price buy cytotec over the counter
https://nolvadexbestprice.pro/# tamoxifen bone density
Link pyramid, tier 1, tier 2, tier 3
Primary – 500 links with positioning within writings on article portals
Secondary – 3000 web address Forwarded links
Tier 3 – 20000 connections assortment, posts, articles
Utilizing a link network is helpful for online directories.
Necessitate:
One link to the website.
Key Phrases.
True when 1 search term from the content subject.
Note the supplementary feature!
Essential! First-level hyperlinks do not overlap with Tier 2 and 3rd-order connections
A link hierarchy is a tool for increasing the liquidity and referral sources of a online platform or social media platform
Link pyramid, tier 1, tier 2, tier 3
Tier 1 – 500 links with positioning within pieces on publishing domains
Level 2 – 3000 domain Rerouted connections
Lower – 20000 references combination, feedback, articles
Employing a link pyramid is advantageous for indexing systems.
Demand:
One reference to the domain.
Search Terms.
True when 1 key phrase from the resource title.
Note the complementary offering!
Important! Tier 1 connections do not coincide with Secondary and 3rd-tier connections
A link network is a device for boosting the flow and backlink portfolio of a internet domain or social media platform
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 connections with integration inside writings on article portals
Secondary – 3000 web address Rerouted references
Lower – 20000 connections combination, comments, articles
Utilizing a link structure is helpful for web crawlers.
Require:
One hyperlink to the site.
Search Terms.
Accurate when 1 key phrase from the resource title.
Highlight the complementary service!
Vital! First-level links do not overlap with 2nd and Tier 3-order hyperlinks
A link structure is a instrument for enhancing the movement and referral sources of a digital property or online community
Link pyramid, tier 1, tier 2, tier 3
Top – 500 links with positioning within articles on writing platforms
Tier 2 – 3000 web address Redirected hyperlinks
Tertiary – 20000 references mix, comments, articles
Using a link structure is helpful for search engines.
Necessitate:
One reference to the site.
Search Terms.
Valid when 1 query term from the content topic.
Remark the additional functionality!
Essential! Top links do not intersect with Secondary and Tier 3-rank hyperlinks
A link pyramid is a device for elevating the circulation and referral sources of a digital property or virtual network
Link pyramid, tier 1, tier 2, tier 3
Tier 1 – 500 hyperlinks with inclusion contained in compositions on publishing domains
Level 2 – 3000 web address Redirected references
Level 3 – 20000 hyperlinks mix, feedback, posts
Employing a link structure is useful for web crawlers.
Require:
One hyperlink to the website.
Key Phrases.
Valid when 1 query term from the resource heading.
Highlight the complementary functionality!
Vital! Tier 1 hyperlinks do not intersect with 2nd and Tier 3-tier references
A link hierarchy is a mechanism for elevating the movement and referral sources of a online platform or online community
https://propeciabestprice.pro/# cost of propecia no prescription