作者背景: 因为在IT行业的缘故,我第一次接触比特币(Bitcoin)大概是在2010~2011年左右,当时1个Bitcoin价格大概低于USD1。 当时觉得新奇好玩,也曾近做过miner,因为只需要开着电脑就能赚Bitcoin。 但是很快就厌倦了,因为对于此技术似懂非懂,在本地(马来西亚),当时Bitcoin也无用武之处,很快的就把整个Bitcoin抛诸脑后。 一直到近一两年,Bitcoin已经无人不晓,但大部分人都抱着观看、怀疑的态度。相信Bitcoin的人却非常狂热的把钱投进Bitcoin及Altcoin里。 其实作者是倾向于前者的,但是Blockhain贵为能够改变世界的新技术,身为科技人的我们一定要搞清楚这门技术。于是在网上看了很多资料,但是现有的资料大多都是以投资(投机)赚钱,而且以英文为主,有些技术名称甚至IT人都不明白,何况是普通人。 所以作者决定在Research同时,把资料记录下来,同时以比较擅长的中文来写,希望更多的人可以了解。     首先,大家要先来认识专用名词 Blockchain – 区块链 Cryptocurrency – 加密货币/电子货币 Bitcoin – 比特币 Ethereum – 以台币 Altcoin – 比特币以外的币(coin),统称Altcoin (Alternative Coin) ICO – Initial Coin Offering – 首次募货币,类似公司上市IPO Mining – 挖矿,实际上是一种电脑程式算法,以确保没有人可以作弊 Proof of Work – 工作量证明 – 目前的Blockchain都以这两种形式运作,以后会加以解释 Proof of Stake – 权益证明 -目前的Blockchain都以这两种形式运作,以后会加以解释 Genesis Block     做为第一篇文章,就先从为何次技术诞生说起吧。(以作者所了解所写出,如果有误请点出) 最初大概在2008年金融海啸时,当时很多人对现有的金融系统产生了怀疑,结果2009年Satoshi Nakamoto就开发出了Bitcoin,把它开源免费放在网上。 到现在为止,没有人知道Satoshi Nakamoto这个人真正是谁,它也很有可能是一个组织。而根据Bitcoin的Blockhain数据查回,这个创始人/组织依然拥有980,000个Bitcoin。   传统的资料储存资料方式,就是把资料存在数据库中,而这些数据库主人能够随时进入或甚至更改。 现有的金融系统就是最佳的列子,人们需要透过银行做交易,把所有资料存进银行的数据库,然后100%服从银行的决定。以技术层面来看,银行里的资料是能被串改的,但人们只能服从。 这就是集中式(centralized)系统,由中间媒介(银行,政府,当权者)来审批交易,由它来决定交易的有效性。 所以当Satoshi Nakamoto要打破这种集中式的金融系统时,传统的集中式数据库方式行不通,所以Blockchain技术就此诞生,简单来说它是: Distributed分散式数据库(例如所有的Bitcoin挖矿者都会储存着一份同样的数据库),任何一个点断了都不会影响整个网络 理论上不能被篡改,只能被验证其资料的真伪 有了Blockchain,Bitcoin才能够实现做为一种电子货币,因为它不需要任何中间媒介(银行)来处理transaction,只需要透过电脑程式运算。   一开始的Bitcoin和Blockhain基本上是一体的,说到Bitcoin就是说着Blockchain。 到后来人们把同样的理论和技术用在其他领域里(金钱交易以外的领域),结果才会开发出各式各样的电子币和应用。 所以现在的Blockchain就犹如Internet的地位,在Blockchain上人们可以开发出前所未有的应用程式,就如当年Internet造就了网页,电邮,等等。   宏观来看 现在的集中式Centralized经济模式,所有资源都掉入集权者手中(大公司、政府、银行等等),它们掌握了顾客的所有资料,你的profile,朋友名单,买卖记录,游览历史,甚至你去过的地方,这就是科技大佬口中的大数据。 数据除了可以拿来卖赚钱,还司用AI来分析顾客的一举一动,再量身定做推销策略,左右你接下来的决定。 这就是集中式Centralized下的世界。   说明白了,不管是cryptocurrency ,blockchain,bitcoin还是什么更难明的专用名字,其目的就是为了打造一个分散式Distributed的世界,把集权者的权利回归到所有人手中。   作者看来,这门科技(cryptocurrency/blockchain…)之所以可以让全世界的人争论不休,不只是它可以赚钱,可以作出前所未有的软件应用,最终甚至可以颠覆整个世界的运作模式。 不怪的Bitcoin狂热分子时常给人有一种叛逆的感觉。   你又憧憬着哪一种模式呢?   下一篇,我们开始来探讨广大群众都有兴趣的话题,如何赚钱?真的吗?还是scam?

Letsencrypt failed to renew

We were getting this letsencrypt renewal error on some Ubuntu 16.04 machines: OSError: Command /opt/ – setuptools pkg_resources pip wheel failed with error code 1 Googling around, hit a few walls and finally found the solution, just need to run this in Ubuntu: export LC_ALL=”en_US.UTF-8″ export LC_CTYPE=”en_US.UTF-8″ Then continue on with the letsencrypt-auto script will do.

Ubuntu run out of space?

If you are getting ‘running out of space’ from your SSH console, but running a df -h shows that there are still plenty of free space left, then most likely inode is the one that run out. To confirm it, just run the command df -i from the result you should be able to a 100% in the mount point, for my case, its at the / partition, hence even tab won’t work. Strategy to solve it is simple, find out which directory use up the inode, and clear it up. `for i in /*; do echo $i; find $i |wc -l;…

Scaling PHP CMS in AWS

There’s two major challenge when scaling a traditional CMS like Prestashop / Drupal: – Centralized session – File storage synchronized – Isolate Backend traffic to a single instance Let’s dive into details for each of them:   Centralized Session This is the easiest one to be taken care of, we will use Redis as the session backend, in AWS, the service is called ElasticCache: Create a new Redis node in AWS for starting, the micro size instance would be sufficient, just scale up later when traffic has grown Get the Endpoint name which should be something like: Put the…

Laratalks #7 – All about A.I.

When comes to Artificial Intelligence, PHP programming language would never cross most programmer’s mind. So happen there is a PHP community called Laravens. They were founded around 6 months ago and organize monthly gathering called Laratalks. Each time they will invite guests from the industry to share cool knowledge among the community. July Laratalks’ topic was about A.I.. When this event details first pop up in my mailbox, I was so excited and signup straightaway. If you are a PHP developer, you would agree that it’s quite hard to find resources to develop AI in PHP. Even though it’s technically possible,…

Cloud – From Freedom to Jail, then back to Freedom

Freedom and flexibility are the main reasons people move to cloud, especially when there are tools like AWS RDBMS. They allow you to move to cloud and freed from your current on-premise vendor. With a BONUS! They also provide the tool that can help you to convert your database from one platform to another, FREEDOM!!! But without realizing it, we are merely switching from one vendor, to another. Meaning from an on-premise vendor to AWS or other cloud service provider. So what? It save costs! Switching to cloud provider will also switch your steady and paid-off budget to an unpredictable one. The…

Cloud – Who stolen my vCPU ?

As discussed in previous posts like public vs private cloud, you are getting vCPU for your public cloud servers, which is shared among other VMs in the same hypervisor. But how do you know if the hypervisor,  the physical hardware CPU itself is being overpopulated? What you need to do is: SSH to your server Run the top command: type top and press enter Take a look at the %st, yap, st stands for steal, the value should remain at 0%: It’s impossible to monitor it by human eyes, for us we add it to Zabbix monitoring by using the Zabbix-agent…

Public cloud and Private cloud

What’s the difference between Public and Private The only main difference between the two is simple: Using public cloud: Sharing the physical hardware with other user Using private cloud: All the VM is sitting on your dedicated servers, sharing resource with no others but your own VM A wider definition of ‘Cloud’ itself could simply be – Offsite infrastructure / Public vs. Private == Shared hosting vs. Dedicated hosting Due to the maturity of virtualisation technology, sharing the same piece of hardware is will no longer be a security concern. Unless you are going for compliance such as PCI-DSS, then…

Scaling on the Cloud – How and When ? Part 2

We have discussed about the HOW of scaling in Part 1, let’s discuss on the WHEN of scaling. 1. Preemptive Scaling In other words, manual scaling. You are expecting an increase of traffic like: A crazy product promotion with huge discount on your e-commerce site Marketing spending to draw huge traffic, such as LINE events, Facebook campaigns, etc. Your guts telling you your site is going viral tomorrow What’s good is this manual thing? Well, there are a few: Run load tests on the manual preemptive infra, tell your marketing team, management team with prove that the infra is ready…

Scaling on the Cloud – How and When ? Part 1

Cloud computing has been known for its flexibility, it can scale anytime. I will scale it down when traffic is low to save my cost, with just a button. I will scale it up when traffic is high to handle my traffic spike, with just a button. But in real world implementation, is it really just with a button? There are two types of scaling: Vertically and Horizontally, of course there are a fresh and new way – Serverless cloud, we will get to that later, due to lack of application support, at least in local market.   Vertical Scaling…