-
Notifications
You must be signed in to change notification settings - Fork 6
/
developer.html
270 lines (258 loc) · 11.9 KB
/
developer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="canonical" href="https://rchain.coop/developer.html"></link>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-6B7FD7W88H"
></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/themes/prism.min.css" integrity="sha512-tN7Ec6zAFaVSG3TpNAKtk4DOHNpSwKHxxrsiw4GHKESGPs5njn/0sMCUMl2svV4wo4BK/rCP7juYz+zx+l6oeQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-bash.min.js" integrity="sha512-JvRd44DHaJAv/o3wxi/dxhz2TO/jwwX8V5/LTr3gj6QMQ6qNNGXk/psoingLDuc5yZmccOq7XhpVaelIZE4tsQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-css.min.js" integrity="sha512-1qYok2x2Rsm2y+mrdyrp00iH7xYSgVyIQ1egDAoT7CBZ3kSzlaJK+NhWAh746NeL3gnH6dnP8FGS+3xOdwO7ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-6B7FD7W88H");
</script>
<script>
/**
* Function that captures a click on an outbound link in Analytics.
* This function takes a valid URL string as an argument, and uses that URL string
* as the event label. Setting the transport method to 'beacon' lets the hit be sent
* using 'navigator.sendBeacon' in browser that support it.
*/
var captureOutboundLink = function(url) {
ga('send', 'event', 'outbound', 'click', url, {
'transport': 'beacon',
'hitCallback': function(){document.location = url;}
});
}
</script>
<script src="/js/jquery-3.3.1.min.js"></script>
<title>RChain | developer</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
charset="UTF-8"
/>
<meta
name="google-site-verification"
content="NvXu2Qnyi90bS-ubPtaorKKja1_p8SHfQ0zPoqG0sIg"
/>
<link rel="stylesheet" href="css/style.css?version=10" />
<link rel="stylesheet" href="css/layout.css?version=5" />
<link rel="shortcut icon" href="assets/favicon-red.png" />
<meta
name="description"
content="RChain is a platform for developers to build confidently and rapidly."
/>
<meta property="og:title" content="RChain" />
<meta property="og:type" content="website" />
<meta
property="og:description"
content="RChain is a platform for developers to build confidently and rapidly."
/>
<meta property="og:url" content="https://rchain.coop" />
<meta
property="og:image"
content="https://rchain.coop/assets/og_index.jpg"
/>
<meta property="og:image:height" content="565" />
<meta property="og:image:width" content="1080" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="RChain| developer" />
<meta
name="twitter:image"
content="https://rchain.coop/assets/og_index.jpg"
/>
<meta name="twitter:creator" content="@rchain_coop" />
<meta name="twitter:url" content="https://rchain.coop/developer.html" />
<meta name="twitter:site" content="https://rchain.coop" />
<meta
name="twitter:description"
content="RChain is a cooperative building a blockchain platform and
social coordination technologies."
/>
</head>
<body class="pageDeveloper">
<header></header>
<div class="bodyWrapper">
<div class="horizontal-nav-cover"></div>
<div class="section" id="developerSection">
<h1>Get started with RChain<sup>®</sup></h1>
<div id="tab">
<div class="item tab active" id="developer">
<a href="javascript:void(0)">Developers</a>
</div>
<div class="item tab" id="validator">
<a href="javascript:void(0)">Validators</a>
</div>
</div>
<div class="tabContent active" id="developerContent">
<div class="flexWrapper">
<div class="textWrapper">
<h2>Build DApps with RChain</h2>
<p>
RChain is a platform for developers to build confidently and
rapidly. With just a few lines of code, your first RChain DApp
can be up and transacting on the blockchain.
</p>
<h2>Quick development setup</h2>
<div class="instructions">
<p>
Let's setup rnode for development, we will install rnode on
the operating system, you can get the installer from
<a
href="https://github.com/rchain/rchain/releases"
target="_blank"
>github/rchain</a
>, also check
<a
href="https://rchain.atlassian.net/wiki/spaces/CORE/pages/428376065/User+guide+for+running+RNode"
target="_blank"
>full documentation</a> if something is missing.
</p>
<p>This guide will <b>only work on rnode 0.12.0+</b></p>
<p><u>on ubuntu/debian</u></p>
<pre class="language-bash"><code class="language-bash">$ apt install ./rnode_0.x.x_all.deb</code></pre>
<p><u>on macOS</u></p>
<ul>
<li>Prerequisites:</li>
<li>
Java - We recommend Open JDK 11,
https://openjdk.java.net/projects/jdk/11/
</li>
<li>
Libsodium - https://download.libsodium.org/doc/ installed in
a standard prefix (/user or /user/local)
</li>
</ul>
<pre class="language-bash"><code class="language-bash">tar -xvf rnode-0.x.x.tgz
cd rnode-0.x.x
./macos_install.sh</code></pre>
<p>
If you have another operating system or want to use docker
please consult
<a
href="https://rchain.atlassian.net/wiki/spaces/CORE/pages/428376065/User+guide+for+running+RNode"
target="_blank"
>full documentation</a
>
</p>
<h3>Configuration files</h3>
<p>
Two configuration files are necessary,
<b class="path">~/.rnode/genesis/bonds.txt</b> file and
<b class="path">~/.rnode/genesis/wallets.txt</b> file. We will use the
following key pair.
</p>
<p class="red">Do not use this private key for any other purpose than development</p>
<pre class="language-bash"><code class="language-bash">private key 28a5c9ac133b4449ca38e9bdf7cacdce31079ef6b3ac2f0a080af83ecff98b36
public key 04be064356846e36e485408df50b877dd99ba406d87208add4c92b3c7d4e4c663c2fbc6a1e6534c7e5c0aec00b26486fad1daf20079423b7c8ebffbbdff3682b58</code></pre>
<pre class="language-bash"><code class="language-bash">mkdir ~/.rnode && mkdir ~/.rnode/genesis
echo "04be064356846e36e485408df50b877dd99ba406d87208add4c92b3c7d4e4c663c2fbc6a1e6534c7e5c0aec00b26486fad1daf20079423b7c8ebffbbdff3682b58 100000000000" > ~/.rnode/genesis/bonds.txt
echo "1111Wbd8KLeWBVsxByF9iksJ4QRRjEF3nq1ScgAw7bMbtomxHsqqd,1000000000000000,0" > ~/.rnode/genesis/wallets.txt</code></pre>
<h3>Running the blockchain</h3>
<p>
Now the configuration files are set up, there is one validator
allowed to deploy, and only one address that has REV. We can
run the node.
</p>
<pre class="language-bash"><code class="language-bash">rnode run -s --validator-private-key 28a5c9ac133b4449ca38e9bdf7cacdce31079ef6b3ac2f0a080af83ecff98b36 --dev-mode</code></pre>
<p>
This node is
standalone, it is a one node blockchain network,
therefore it does not download any block and starts at
block height 0. It is
executed with the <b class="path">--dev-mode</b>
option, so the API is an extended API with explore deploy
available.
</p>
<h3>Do a first deploy and propose block</h3>
<p>
Now in another shell let's deploy our first rholang file and
propose the block.
</p>
<pre class="language-bash"><code class="language-bash">echo "new stdout(\`rho:io:stdout\`) in { stdout!(\"hello world\") }" > hello.rho
rnode deploy --valid-after-block-number 0 --phlo-price 1 --phlo-limit 10000000 --private-key 28a5c9ac133b4449ca38e9bdf7cacdce31079ef6b3ac2f0a080af83ecff98b36 hello.rho
rnode --grpc-port 40402 propose</code></pre>
<p>
You should see "hello world" pop up in the logs, it means that your deploy has been included into a block, and the transaction has been executed.
</p>
</div>
<p>
You can check the
<a
href="https://rchain.atlassian.net/wiki/spaces/CORE/pages/428376065/User+guide+for+running+RNode"
target="_blank"
>full documentation</a
>
to go further, also check the
<a
target="_blank"
href="https://github.com/fabcotech/rchain-toolkit"
>
rchain-toolkit javascript SDK
</a>
<br />
<br />
Please reach out to us on
<a target="_blank" href="https://discord.gg/NWkQnfH">Discord</a>
if you encounter any issue.
<br />
</p>
<h2>Rholang</h2>
<ul class="list">
<li>
<a target="_blank" href="https://github.com/rchain/rchain/blob/dev/rholang/reference_doc/rho_cheatsheet.pdf">rholang cheat sheet</a>
</li>
<li>
<a target="_blank" href="https://developer.rchain.coop/rholang-playground">Rholang playground</a>
</li>
<li>
<a target="_blank" href="https://rholang.github.io/">rholang.github.io</a>
</li>
<li>
<a
target="_blank" href="https://github.com/rchain/rchain/blob/master/docs/rholang/rholangtut.md"
>Tutorial by RChain Platform Devs</a
>
</li>
<li>
<a
href="https://github.com/JoshOrndorff/LearnRholangByExample"
>Joshy Orndorff's Rholang Tutorial</a
>
</li>
<li>
<a href="https://youtu.be/7tW1fAWg6s8"
>Greg Meredith's Devcon3 Rholang talk</a
>
</li>
</ul>
</div>
</div>
</div>
<div class="tabContent" id="validatorContent">
<div class="flexWrapper">
<div class="textWrapper">
<h2>More information for validators is coming soon!</h2>
<p>
Mainnet is currently running with 30 coop run validator nodes
plus. This is expected to change around Q2 2022 with the POS developments.
</p>
</div>
</div>
</div>
</div>
</div>
<div id="footer"></div>
<script src="/js/rchain.coop_Browser.js"></script>
<script src="/js/get-started_Browser.js"></script>
<script src="/js/navAndFooter.js?version=5"></script>
</body>
</html>