-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
565 lines (400 loc) · 33.3 KB
/
index.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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<!DOCTYPE HTML>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
<meta charset="utf-8">
<title>Charis</title>
<meta name="author" content="Andrew Saintway">
<meta name="description" content="Declaration of the Independence of Cyberspace">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta property="og:site_name" content="Charis">
<meta property="og:image" content="undefined">
<link href="/favicon.png" rel="icon">
<link rel="stylesheet" href="/css/bootstrap.min.css" media="screen" type="text/css">
<link rel="stylesheet" href="/css/font-awesome.css" media="screen" type="text/css">
<link rel="stylesheet" href="/css/style.css" media="screen" type="text/css">
<link rel="stylesheet" href="/css/highlight.css" media="screen" type="text/css">
<link rel="stylesheet" href="/css/google-fonts.css" media="screen" type="text/css">
<link rel="stylesheet" href="/css/notebook.css" media="screen" type="text/css">
<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<script src="/js/jquery-2.0.3.min.js"></script>
<!-- analytics -->
</head>
</html>
<body>
<nav id="main-nav" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<button type="button" class="navbar-header navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Charis</a>
<div class="collapse navbar-collapse nav-menu">
<ul class="nav navbar-nav">
<li>
<a href="/archives" title="All the articles.">
<i class="fa fa-archive"></i>Archives
</a>
</li>
<li>
<a href="/categories" title="All the categories.">
<i class="fa fa-folder"></i>Categories
</a>
</li>
<li>
<a href="/tags" title="All the tags.">
<i class="fa fa-tags"></i>Tags
</a>
</li>
<li>
<a href="/about" title="About us.">
<i class="fa fa-user"></i>About
</a>
</li>
</ul>
</div>
</div> <!-- container -->
</nav>
<div class="clearfix"></div>
<div class="container">
<div class="content">
<div class="page-header">
<h1>Charis</h1>
</div>
<div class="row page">
<div class="col-md-9">
<div class="slogan">
<i class="fa fa-heart"></i>
$GoodBit - An Independent Stablecoin of Cyberspace
</div>
<div class="mypage">
<!-- title and entry -->
<!-- display as entry -->
<h3 class="title">
<div class="date"> 2022-02-28 </div>
<div class="article-title"><a href="/2022/02/28/An-Independent-Stablecoin-of-Cyberspace/" >An Independent Stablecoin of Cyberspace</a></div>
</h3>
<div class="entry">
<div class="row">
<div class="col-md-12">
<p>The project <a href="https://gitcoin.co/grants/4748/an-independent-stablecoin-of-cyberspace" target="_blank" rel="noopener">¹</a> we want to do is called “typography” or “digitypography”. The purpose is to build a new stablecoin system. $Typography and $GoodBit is the main currency pair in the system. The stabilization mechanism is to control the supply of $GoodBit by burning a certain amount of $Typography to mint one $GoodBit or minting a certain amount of $Typography to burn one $GoodBit, so that one $GoodBit can be paid on average for the purpose of copying and quoting one bit of NFT content. Specifically, the “General Knowledge Graph” should be implemented in the form of “Directed Acyclic Graph”, and version control should be implemented for all NFT content in the system. Each specific version of NFT is similar to one commit in git version control system. The owner of the NFT can issue the corresponding CQLTs (Copy and Quote License Tokens). Others can buy and burn multiple different CQLTs to mint their own NFT. This new NFT is then connected as a successor node to the corresponding NFTs of those CQLTs, so as to realize the historical proof of NFT merges and changes. This huge NFT graph is stored in a permanent way. And then all the transaction records of CQLTs and $GoodBits are used to control the issuance of $GoodBits. Specifically, we need to track the circulation of each CQLT. Each CQLT has a price in $GoodBit based on its latest transaction or destruction record. Track all the CQLTs, the sum of their prices in $GoodBits, divided by the sum of the bits of their corresponding NFT content, we can obtain the average price in $GoodBit for copying and quoting one bit of NFT content on average within the whole system. In addition, we know the price of one $GoodBit in $Typography in the trading market of $GoodBit and $Typography. Therefore, we can calculate the average price in $Typography for copying and quoting one bit. The stability mechanism of the whole system is to achieve the purpose of adjusting the average price of copying and quoting one bit to one $GoodBit by allowing a two-way free burning and minting of one $GoodBit with a certain amount of $Typography required for copying and quoting one bit on average.</p>
<p>Outside the digital economy and within the real economy, commodities can also be tokenized into CQLTs. Everyone can burn their CQLTs to “mint” their commodities. Because the batch production behavior is essentially the batch copy behavior. All designs can actually use NFTs to prove their copyright.</p>
<hr>
<blockquote>
<p>人类走出文中第一章,即商品货币从无到有,经历了上千年,走出文中第二章,即信用货币挑战并取代商品货币,经历了约 200 年,目前正经历文中第三章的阶段,即信用货币之间互相竞争,至今时间约为 50 年。<br>加密货币行业以 2015 年 Bitfinex 上线 USDT 交易山寨币取代了 BTC 作为山寨币交易对为时间点,标志着行业结束了只有商品货币的时代;目前 Binance 交易所发行了自己的 BUSD,Terra 发行了 UST,以及诸如 MIM、OHM 等算法稳定币,标志着信用货币开始全方位挑战商品货币,并捷报频传;可以预见未来不管监管的尺度松紧,行业一定会进入信用货币互相竞争的阶段,届时所有的项目都会将被问道:“为什么不发稳定币”。<a href="https://y2z.io/article/33" target="_blank" rel="noopener">²</a></p>
</blockquote>
<p>我们想做的项目叫做“印刷术”(typography、digitypography)。目的是构建一个基于开放式博弈的生态型稳定币系统。“印刷术”($Typography)和“好比特”($GoodBit)是其中一对货币对。稳定机制是通过销毁一定量的“印刷术”铸造一个“好比特”或者销毁一个“好比特”铸造一定量的“印刷术”来控制“好比特”的发行量,以达到一个“好比特”在一般水平上可以用来购买一个比特量的 NFT 内容的“复制引用权”的目的。具体来说,要用“有向无环图”(DAG)的方式实现“通用知识图谱”,对所有的 NFT 的内容实现版本控制。每一个特定的版本的 NFT 类似 git 里面的 commit。NFT 的所有者可以发行相应的“复制引用许可代币”(Copy and Quote License Token)。其他的人可以购买并销毁多个不同的“复制引用许可代币”来铸造自己的 NFT。这个新的 NFT 就以后继节点的方式连接到那些“复制引用许可代币”相应的 NFT 之后,以实现 NFT 的合并和更改的历史证明。这个巨大的 NFT 图谱以永存的方式存储。而所有“复制引用许可代币”和“好比特”的交易记录被用来控制“好比特”的发行量。具体来说,要追踪每一个“复制引用许可代币”的流通。每一个“复制引用许可代币”根据其最新的交易或者销毁记录,有一个以“好比特”计价的价格。追踪所有的“复制引用许可代币”,它们以“好比特”计价的价格的总和、除以、它们相应的 NFT 内容的比特量的总和,可以得到、整个系统之内、复制引用一个比特以“好比特”计价的平均价格。另外,我们知道“印刷术”与“好比特”的交易市场中,一个“好比特”以“印刷术”计价的价格。因此,我们可以算出、复制引用一个比特以“印刷术”计价的平均价格。整个系统的稳定机制是,通过允许、一个“好比特”与复制引用一个比特在一般水平上所需支付的“印刷术”的、双向自由的销毁铸造,来达到、把复制引用一个比特的平均价格调整为一个“好比特”、的目的。</p>
<p>在数字经济之外、实体经济之内,日用商品也可以代币化为 CQLT。每个人都可以销毁他们的 CQLT 来“铸造”他们的日用商品。因为批量生产行为实质上是批量复制行为。所有种类的设计其实都可以用 NFT 来证明版权。</p>
<hr>
<p>私たちがやりたいプロジェクトは「タイポグラフィ」(typography)、「デジタイポグラフィ」(digitypography)と呼ばれています。目的は、新しいステーブルコインシステムを構築することです。「印刷術」($Typography)と「良いビット」($GoodBit)はその中に主な通貨ペアです。</p>
<p>価格安定化メカニズムは、「良いビット」を鋳造するために一定量の「印刷術」を焼却するか、「良いビット」を焼却するために一定量の「印刷術」を鋳造することによって、「良いビット」の発行量を制御することです。これにより、一般的に、一個ビットの NFT コンテンツをコピーして参照するために、一個「良いビット」で支払うことができます。</p>
<p>具体的には、「一般知識グラフ」というのを、「有向非巡回グラフ」(DAG)の形式で実装する必要があり、バージョン管理はすべての NFT コンテンツに実装する必要があります。NFT の各特定のバージョンは、git でのコミットに似ています。</p>
<p>NFT の所有者は、その NFT に対応する「コピー参照ライセンストークン」(Copy and Quote License Token)を発行できます。</p>
<p>他の人は、複数の異なる「コピー参照ライセンストークン」を購入して焼却し、自分の NFT を鋳造することができます。次に、その新しい NFT は、後続ノードの形式で「コピー参照ライセンストークン」に対応する NFT に接続され、NFT の合併と変更の歴史を証明します。</p>
<p>この巨大な NFT グラフは、永続的な方法で保存されます。また、「コピー参照ライセンストークン」と「良いビット」のすべての取引履歴は、「良いビット」の発行を制御するために使用されます。</p>
<p>具体的には、各「コピー参照ライセンストークン」の流通を追跡します。各「コピー参照ライセンストークン」には、最新の取引または焼却の記録に基づいた「良いビット」で表される価格があります。</p>
<p>すべての「コピー参照ライセンストークン」を追跡して、システム全体で一個ビットをコピーして参照するためにの「良いビット」で表される平均価格は、「良いビット」で表される価格の合計を、対応する NFT コンテンツのビットの合計で、割ったものです。</p>
<p>さらに、私たちは、「印刷術」と「良いビット」の取引市場によって、一個「良いビット」が「印刷術」で表される価格を知っています。したがって、一個ビットをコピーして参照するためにの「印刷術」で表される平均価格を計算できます。</p>
<p>システム全体の価格安定メカニズムは、一個「良いビット」と、一個ビットをコピーして参照するために一般的に必要とされる「印刷術」を、自由に鋳造と焼却を可能にすることによって、ビットをコピーして参照する平均価格を一個「良いビット」に調整する目的を達成します。</p>
</div>
</div>
<a type="button" href="/2022/02/28/An-Independent-Stablecoin-of-Cyberspace/#more" class="btn btn-default more">阅读此文</a>
</div>
<!-- display as entry -->
<h3 class="title">
<div class="date"> 2022-02-28 </div>
<div class="article-title"><a href="/2022/02/28/Add-Tweets-to-My-Blog/" >Add Tweets to Home Page</a></div>
</h3>
<div class="entry">
<div class="row">
<div class="col-md-12">
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Browser-Side">Browser Side<a class="anchor-link" href="#Browser-Side">¶</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [ ]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">cat</span> <span class="o"><<</span> <span class="n">EOF</span> <span class="o">></span> <span class="o">~/</span><span class="n">digitypography</span><span class="o">/</span><span class="n">themes</span><span class="o">/</span><span class="n">freemind</span><span class="o">/</span><span class="n">source</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">twitter</span><span class="o">.</span><span class="n">js</span>
<span class="n">var</span> <span class="n">twitter</span> <span class="o">=</span> <span class="p">(</span><span class="n">function</span><span class="p">()</span> <span class="p">{</span>
<span class="n">function</span> <span class="n">escapeHtml</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> \<span class="err">$</span><span class="p">(</span><span class="s1">'<div/>'</span><span class="p">)</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span><span class="o">.</span><span class="n">html</span><span class="p">();</span>
<span class="p">}</span>
<span class="n">function</span> <span class="n">render</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">tweets</span><span class="p">)</span> <span class="p">{</span>
<span class="n">var</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">fragment</span> <span class="o">=</span> <span class="s1">''</span><span class="p">,</span> <span class="n">t</span> <span class="o">=</span> \<span class="err">$</span><span class="p">(</span><span class="n">target</span><span class="p">)[</span><span class="mi">0</span><span class="p">];</span>
<span class="k">for</span><span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">tweets</span><span class="o">.</span><span class="n">length</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fragment</span> <span class="o">+=</span> <span class="s1">'<li><i class="fa fa-star"></i><a href="https://twitter.com/charisbit/status/'</span> <span class="o">+</span> <span class="n">tweets</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">id</span> <span class="o">+</span> <span class="s1">'">'</span>
<span class="o">+</span> <span class="n">tweets</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">created_at</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">'T'</span><span class="p">,</span> <span class="s1">' '</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">'.000Z'</span><span class="p">,</span> <span class="s1">' UTC'</span><span class="p">)</span> <span class="o">+</span> <span class="s1">'</a><p>'</span> <span class="o">+</span> <span class="n">escapeHtml</span><span class="p">(</span><span class="n">tweets</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">text</span><span class="o">||</span><span class="s1">''</span><span class="p">)</span> <span class="o">+</span> <span class="s1">'</p></li>'</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">t</span><span class="o">.</span><span class="n">innerHTML</span> <span class="o">=</span> <span class="n">fragment</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="p">{</span>
<span class="n">showTweets</span><span class="p">:</span> <span class="n">function</span><span class="p">(</span><span class="n">options</span><span class="p">)</span> <span class="p">{</span>
<span class="n">options</span><span class="o">.</span><span class="n">blacklist</span> <span class="o">=</span> <span class="n">options</span><span class="o">.</span><span class="n">blacklist</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">','</span><span class="p">);</span>
\<span class="err">$</span><span class="o">.</span><span class="n">ajax</span><span class="p">({</span>
<span class="n">url</span><span class="p">:</span> <span class="s1">'https://jhub.name/typography/?tweet.fields=created_at&max_results='</span> <span class="o">+</span> <span class="n">options</span><span class="o">.</span><span class="n">count</span>
<span class="p">,</span> <span class="n">dataType</span><span class="p">:</span> <span class="s1">'json'</span>
<span class="p">,</span> <span class="n">error</span><span class="p">:</span> <span class="n">function</span> <span class="p">(</span><span class="n">err</span><span class="p">)</span> <span class="p">{</span> \<span class="err">$</span><span class="p">(</span><span class="n">options</span><span class="o">.</span><span class="n">target</span> <span class="o">+</span> <span class="s1">' li.loading'</span><span class="p">)</span><span class="o">.</span><span class="n">addClass</span><span class="p">(</span><span class="s1">'error'</span><span class="p">)</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s1">'Error loading feed'</span><span class="p">);</span> <span class="p">}</span>
<span class="p">,</span> <span class="n">success</span><span class="p">:</span> <span class="n">function</span> <span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span>data <span class="o">)</span> <span class="o">{</span> <span class="k">return</span><span class="p">;</span> <span class="o">}</span>
<span class="n">var</span> <span class="n">tweets</span> <span class="o">=</span> <span class="p">[];</span>
<span class="k">for</span> <span class="p">(</span><span class="n">var</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">length</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">options</span><span class="o">.</span><span class="n">blacklist</span> <span class="n">instanceof</span> <span class="n">Array</span> <span class="o">&&</span> <span class="n">options</span><span class="o">.</span><span class="n">blacklist</span><span class="o">.</span><span class="n">indexOf</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="o">!==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span> <span class="k">continue</span><span class="p">;</span> <span class="p">}</span>
<span class="n">tweets</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
<span class="p">}</span>
<span class="n">render</span><span class="p">(</span><span class="n">options</span><span class="o">.</span><span class="n">target</span><span class="p">,</span> <span class="n">tweets</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">})();</span>
<span class="n">EOF</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Server-Side">Server Side<a class="anchor-link" href="#Server-Side">¶</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<ul>
<li><a href="https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference" target="_blank" rel="noopener">https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference</a></li>
</ul>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [ ]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">curl</span> <span class="o">-</span><span class="n">H</span> <span class="s2">"Authorization: Bearer $</span><span class="si">{BEARER_TOKEN}</span><span class="s2">"</span> <span class="s1">'https://api.twitter.com/2/users/by/username/charisbit?user.fields=created_at'</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_subarea output_stream output_stdout output_text">
<pre>{"data":{"name":"Charis","username":"charisbit","created_at":"2022-02-28T13:05:23.000Z","id":"1498283136295211010"}}</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<ul>
<li><a href="https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets" target="_blank" rel="noopener">https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets</a></li>
</ul>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [ ]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">curl</span> <span class="o">-</span><span class="n">H</span> <span class="s2">"Authorization: Bearer $</span><span class="si">{BEARER_TOKEN}</span><span class="s2">"</span> <span class="s1">'https://api.twitter.com/2/users/1498283136295211010/tweets?tweet.fields=created_at&max_results=10'</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_subarea output_stream output_stdout output_text">
<pre>{"meta":{"result_count":0}}</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<ul>
<li>My solution using <a href="https://doc.traefik.io/traefik/v1.7/basics/#custom-headers" target="_blank" rel="noopener">Traefik</a> to proxy Tweets API</li>
</ul>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [ ]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">cat</span> <span class="o"><<</span> <span class="n">EOF</span> <span class="o">|</span> <span class="n">sudo</span> <span class="n">tee</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">tljh</span><span class="o">/</span><span class="n">state</span><span class="o">/</span><span class="n">dynamic</span><span class="o">/</span><span class="n">typography</span><span class="o">.</span><span class="n">toml</span> <span class="o">></span> <span class="o">/</span><span class="n">dev</span><span class="o">/</span><span class="n">null</span>
<span class="p">[</span><span class="n">frontends</span><span class="o">.</span><span class="n">typography</span><span class="p">]</span>
<span class="n">backend</span> <span class="o">=</span> <span class="s2">"typography"</span>
<span class="p">[</span><span class="n">frontends</span><span class="o">.</span><span class="n">typography</span><span class="o">.</span><span class="n">routes</span><span class="o">.</span><span class="n">r1</span><span class="p">]</span>
<span class="n">rule</span> <span class="o">=</span> <span class="s2">"PathPrefix:/typography/"</span>
<span class="p">[</span><span class="n">frontends</span><span class="o">.</span><span class="n">typography</span><span class="o">.</span><span class="n">routes</span><span class="o">.</span><span class="n">r2</span><span class="p">]</span>
<span class="n">rule</span> <span class="o">=</span> <span class="s2">"ReplacePath:/2/users/1498283136295211010/tweets"</span>
<span class="p">[</span><span class="n">frontends</span><span class="o">.</span><span class="n">typography</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">customrequestheaders</span><span class="p">]</span>
<span class="n">Authorization</span> <span class="o">=</span> <span class="s2">"Bearer $</span><span class="si">{BEARER_TOKEN}</span><span class="s2">"</span>
<span class="p">[</span><span class="n">frontends</span><span class="o">.</span><span class="n">typography</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">customresponseheaders</span><span class="p">]</span>
<span class="n">Access</span><span class="o">-</span><span class="n">Control</span><span class="o">-</span><span class="n">Allow</span><span class="o">-</span><span class="n">Origin</span> <span class="o">=</span> <span class="s2">"*"</span>
<span class="p">[</span><span class="n">backends</span><span class="o">.</span><span class="n">typography</span><span class="o">.</span><span class="n">servers</span><span class="o">.</span><span class="n">s1</span><span class="p">]</span>
<span class="n">url</span> <span class="o">=</span> <span class="s2">"https://api.twitter.com"</span>
<span class="n">weight</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">EOF</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [ ]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">sudo</span> <span class="n">systemctl</span> <span class="n">restart</span> <span class="n">traefik</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [ ]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">curl</span> <span class="s1">'https://jhub.name/typography/?tweet.fields=created_at&max_results=10'</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_subarea output_stream output_stdout output_text">
<pre>{"data":[{"created_at":"2022-02-28T14:15:00.000Z","id":"1498300708893835264","text":"$GoodBit is designed to measure the meaningfulness for bits. The average $GoodBit of each bit of contents of NFTs of corresponding Copy and Quote License Tokens is stabilized at 1 $GoodBit, so that 1 $GoodBit can be used to pay for copying and quoting 1 bit on average."}],"meta":{"oldest_id":"1498300708893835264","newest_id":"1498300708893835264","result_count":1}}</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<a type="button" href="/2022/02/28/Add-Tweets-to-My-Blog/#more" class="btn btn-default more">阅读此文</a>
</div>
</div>
<!-- pagination -->
<div>
<center>
<div class="pagination">
<ul class="pagination">
</ul>
</div>
</center>
</div>
</div> <!-- col-md-9 -->
<div class="col-md-3">
<div id="sidebar">
<div class="widget">
<h4 style="margin-top: 18px;">标签云</h4>
<ul class="tag_box inline list-unstyled">
<li><a href="/tags/Notebooks/">Notebooks<span>1</span></a></li>
<li><a href="/tags/Typography/">Typography<span>1</span></a></li>
</ul>
</div>
<div class="widget">
<h4 style="margin-top: 18px;">最新文章</h4>
<ul class="entry list-unstyled">
<li>
<a href="/2022/02/28/An-Independent-Stablecoin-of-Cyberspace/" ><i class="fa fa-file-o"></i>An Independent Stablecoin o...</a>
</li>
<li>
<a href="/2022/02/28/Add-Tweets-to-My-Blog/" ><i class="fa fa-file-o"></i>Add Tweets to Home Page</a>
</li>
</ul>
</div>
<div class="widget" style="border-bottom: none;">
<h4 style="margin-top: 18px;">链接</h4>
<ul class="blogroll list-unstyled">
<li>
<i class="fa fa-github"></i>
<a href="https://github.com/charisbit" title="Charis's Github repository." target="_blank">Charis's Github</a>
</li>
<li>
<i class="fa fa-twitter"></i>
<a href="https://twitter.com/charisbit" title="Charis's Twitter account." target="_blank">Charis's Twitter</a>
</li>
</ul>
</div>
<div class="widget" style="border-bottom: none;">
<h5>GitHub Repos</h5>
<ul id="gh_repos" class="list-unstyled">
<li class="loading">Status updating…</li>
</ul>
<a href="https://github.com/charisbit" target="_blank">@charisbit</a> on GitHub
<script src="/js/github.js" type="text/javascript"></script>
<script type="text/javascript">
github.showRepos({
user: 'charisbit',
count: 0,
skip_forks: true,
target: '#gh_repos',
blacklist: ''
});
</script>
</div>
<div class="widget">
<h5>Twitter Tweets</h5>
<ul id="tweets" class="list-unstyled"><li class="loading">Status updating…</li></ul>
<a href="https://twitter.com/charisbit" target="_blank">@charisbit</a> on Twitter
<script src="/js/twitter.js" type="text/javascript"></script>
<script type="text/javascript">
twitter.showTweets({
count: 10,
target: '#tweets',
blacklist: ''
});
</script>
</div>
</div> <!-- sidebar -->
</div> <!-- col-md-3 -->
</div> <!-- row-fluid -->
</div>
</div>
<div class="container-narrow">
<footer> <p>
© 2022 Andrew Saintway
with help from <a href="http://hexo.io/" target="_blank">Hexo</a> and <a href="http://getbootstrap.com/" target="_blank">Twitter Bootstrap</a>. Theme by <a href="http://github.com/wzpan/hexo-theme-freemind/">Freemind</a>.
</p> </footer>
</div> <!-- container-narrow -->
<a id="gotop" href="#">
<span>▲</span>
</a>
<script src="/js/jquery.imagesloaded.min.js"></script>
<script src="/js/gallery.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/main.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
(function($){
$('.fancybox').fancybox();
})(jQuery);
</script>
</body>
</html>