本地环境的智能合约编写

小白星云链dapp开发之旅

基于区块链的应用与传统应用的区别

基于区块链的应用,又称为dapp,与传统app区别很大,主要在于dapp中没有中心化的服务器。dapp之于区块链,就像app之于ios/android,运行于分布式网络,网络节点调用智能合约就像app向服务器发送请求一样,不过dapp的数据被安全地存储在区块链上,一旦上链无法被更改,而app的数据被存储在数据库中,由提供服务方保管。

搭建本地环境

1.安装go环境

brew install go
vim ~/.bash_profile
设置环境变量:

<pre class="prettyprint linenums prettyprinted" data-anchor-id="0j61" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. export GOPATH=<gopath>
  2. export GOBIN=$GOPATH/bin
  3. export PATH=$PATH:$GOBIN

</pre>

注意1:$GOPATH最好设置在用户目录下,并且不能和GOROOT一样。
注意2:如果没有装homebrew,或者没有更新homebrew,可以下载安装homebrew,也可以去go官网下载安装包,直接安装。
注意3:设置完环境变量以后需要执行source ~/.bash_profile保存

2下载源码

执行git clone命令:

<pre class="prettyprint linenums prettyprinted" data-anchor-id="u7he" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. git clone -b v1.0.0 https://github.com/nebulasio/go-nebulas.git --depth=1

</pre>

这个过程会很慢,但是一定要通过这种方法下载下来,否则会影响后面编译过程。下载的源码放在$PATH/src下,需要新建目录src

3安装rocksdb依赖库

  • 首先要安装支持 C++11 的 C++ 编译器,需要安装gcc4.8以上版本,执行:
    brew install gcc@4.9
    vim ~/.zshrc
    设置环境变量:

<pre class="prettyprint linenums prettyprinted" data-anchor-id="7rxa" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. alias gcc="gcc-4.9"
  2. alias g++="g++-4.9"
  3. alias cc="gcc-4.9"
  4. alias c++="c++-4.9"

</pre>

然后执行source ~/.zshrc保存文件

  • 安装 rocksdb:
    brew install rocksdb

4安装go依赖库

使用brew安装dep:

<pre class="prettyprint linenums prettyprinted" data-anchor-id="lq6p" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. $ brew install dep
  2. $ brew upgrade dep

</pre>

切换至项目根目录安装go的依赖库:

<pre class="prettyprint linenums prettyprinted" data-anchor-id="hab2" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. cd <path>/go-nebulas
  2. make dep

</pre>

这里等待时间比较长,耐心等就好。

5安装v8

在项目根目录$PASH/src/github.com/nebulasio/go-nebulas直接执行:
make deploy-v8

6编译可执行文件

在项目根目录下执行:
make build
编译完成后就可以启动种子节点和普通节点,以及启动控制台。

7启动种子节点,普通节点,控制台

星云链节点可以通过执行编译后的neb可执行文件启动。节点启动需在终端执行,Neb节点包括种子节点和节点:

  • 种子节点:星云链网络种子节点,为其他节点提供初始同步服务;
  • 节点:星云链网络普通节点,启动后会先从种子节点同步路由和区块信息。

启动种子节点:./neb -c conf/default/config.conf
启动普通节点:./neb -c conf/example/miner.conf
进入控制台:./neb console

8控制台

控制台封装了很多有用的函数,常用的包括:sendTransaction,getTransactionReceipt,getAccountState等等,可以通过api.+tab键,admin.+tab键查看。
介绍下常用函数:

  • sendTransation(from, to, value, nonce, gasPrice, gasLimit, contract),发送交易和,部署合约,执行合约,返回结果为哈希和合约地址
    from: 用户钱包地址
    to: 目标账户地址
    value: 调用智能合约用于转账的金额
    nonce: from用户transaction标识,严格递增1
    value:部署合约时为"0",转账时为转账金额;
    gasPrice:部署智能合约用到的gasPrice,可以通过GetGasPrice获取,或者使用默认值:"1000000";
    gasLimit: 部署合约的gasLimit,也可以设置一个较大值"2000000",执行时以实际使用计算。
    contract: 合约信息,部署合约时传入的参数
注1:from和to相同时,用于部署合约,不同时用于发送交易;
注2:发送转账交易时,value为转账金额,在部署和调用智能合约时,v#####alue最好一直保持为0,否则自动转账到to账户;
注3:nonce严格自增1,在使用这个函数之前,先使用api.getAccountState()查看账户的信息,把返回结果的nonce加1后填入。
注4:contract在发送交易时为空(不写),

在部署合约时,contract包括以下几个字段:

  • source: 合约代码
  • sourceType: 合约代码类型,支持jsts(对应javaScript和typeScript代码)
  • args: 合约初始化方法参数,无参数为空字符串,有参数时为字符串数组,形如["abc","eee"]
    在调用合约时,contract包括:
  • function: 调用合约方法
  • args: 合约方法参数,无参数为空字符串,有参数时为字符串数组
  • getUnlockAccount(),参数为账户地址
    如果遇到报错信息是 account is locked ,使用这个函数解锁账户。

  • getTransactionReceipt(),参数为交易哈希,返回结果是一个json字符串,

<pre class="prettyprint linenums prettyprinted" data-anchor-id="2c4e" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. "result": {
  2. "chainId": 100,
  3. "contract_address": "",
  4. "data": "eyJGdW5jdGlvbiI6ImdhbWUiLCJBcmdzIjoiW1wiOFwiLFwiMTB cIl0ifQ==",
  5. "from": "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh",
  6. "gas_limit": "2000000",
  7. "gas_price": "1000000",
  8. "gas_used": "23729",
  9. "hash": "a807f627e5d0ef520daf9855346f82479a073dae6a0932bd6d3 646da8c6d913c",
  10. "nonce": "56",
  11. "status": 1,
  12. "timestamp": "1524734919",
  13. "to": "n1iFiFDnJdMDHAswsM5XkpymNJhv3hTBaC7",
  14. "type": "call",
  15. "value": "50"
  16. }

</pre>

status字段:0,1,2三种状态,对应错误,成功,等待。

  • getAccountState(),参数是账户地址,

<pre class="prettyprint linenums prettyprinted" data-anchor-id="i5mk" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. "result": {
  2. "balance": "4999999999998755939999508",
  3. "nonce": "55",
  4. "type": 87
  5. }

</pre>

注:nonce严格自增1

编写部署智能合约

1部署合约前的了解工作

  • 存储属性,分为map属性和非map属性

<pre class="prettyprint linenums prettyprinted" data-anchor-id="i7s5" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. LocalContractStorage.defineMapProperty(this, "bankVault", {
  2. parse: function (text) {
  3. return new DepositeContent(text);
  4. },
  5. stringify: function (o) {
  6. return o.toString();
  7. }
  8. });
  9. LocalContractStorage.defineProperty(this, "banker");
  10. LocalContractStorage.defineProperty(this, "gameVault");

</pre>

bankVault为map属性,banker,gameVoult为非map属性,map属性可以进行读写和遍历操作,方法详见wiki。非map属性直接读写。

<pre class="prettyprint linenums prettyprinted" data-anchor-id="urmb" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. this.banker = from;//非map属性写
  2. this.bankVault.put(from, depositTemp);//map写
  3. var cur_deposit = this.bankVault.get(from);//map读
  4. //map遍历
  5. forEach: function(limit, offset){
  6. limit = parseInt(limit);
  7. offset = parseInt(offset);
  8. if(offset>this.size){
  9. throw new Error("offset is not valid");
  10. }
  11. var number = offset+limit;
  12. if(number > this.size){
  13. number = this.size;
  14. }
  15. var result = "";
  16. for(var i=offset;i<number;i++){
  17. var key = this.arrayMap.get(i);
  18. var object = this.dataMap.get(key);
  19. result += "index:"+i+" key:"+ key + " value:" +object+"_";
  20. }
  21. return result;
  22. }

</pre>

  • 方法,分为公有和私有方法,私有方法以“_"开头,用户不能直接调用执行私有方法。方法的参数读取来自于args(见前文args[]介绍),此处参数类型为字符串,必要时进行类型转换。

<pre class="prettyprint linenums prettyprinted" data-anchor-id="nae0" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. if(parseInt(subscript)<14&&parseInt(subscript)>0){
  2. porkPoint = arr[parseInt(subscript)-1];
  3. }else{
  4. throw new Error("No sufficient subscript.");
  5. }

</pre>

  • BigNumber,这是一个智能合约里面定义的数据类型,它的四则运算都是有定义的,用的时候不能把它当做普通整型浮点型进行运算,否则会产生错误。
    详见BigNumberAPI。

<pre class="prettyprint linenums prettyprinted" data-anchor-id="s81s" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. bonus = bonus.plus(depositT.bets);//加法

</pre>

2编写部署智能合约

2.1 prototyppe

  • 除了null以外,javascript的每个对象都是继承于prototype对象,原型对象上的所有属性和方法,都能被派生对象共享。
  • 原型对象的属性不是实例对象自身的属性。只要修改原型对象,变动就立刻会体现在所有实例对象上。

2.2code style

智能合约一般采用js编写,具有js代码的特点,需要注意类型关键字的使用,除此以外,智能合约代码编写应该保持功能单一原则,注意数据结构的变换。

<pre class="prettyprint linenums prettyprinted" data-anchor-id="v845" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 14px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 20px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: rgba(102, 128, 153, 0.0470588); border: 0px solid rgba(0, 0, 0, 0.14902); background-image: none; background-attachment: scroll; box-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 2px inset, rgba(102, 128, 153, 0.0470588) 45px 0px 0px inset, rgba(102, 128, 153, 0.0470588) 0px 1px 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: 0px 0px; background-repeat: repeat repeat;">

  1. 'use strict';

  2. var DepositeContent = function (text) {

  3. if (text) {

  4. var o = JSON.parse(text);

  5. this.balance = new BigNumber(o.balance);

  6. this.expiryHeight = new BigNumber(o.expiryHeight);

  7. } else {

  8. this.balance = new BigNumber(0);

  9. this.expiryHeight = new BigNumber(0);

  10. }

  11. };

  12. DepositeContent.prototype = {

  13. toString: function () {

  14. return JSON.stringify(this);

  15. }

  16. };

  17. var BankVaultContract = function () {

  18. LocalContractStorage.defineMapProperty(this, "bankVault", {

  19. parse: function (text) {

  20. return new DepositeContent(text);

  21. },

  22. stringify: function (o) {

  23. return o.toString();

  24. }

  25. });

  26. };

  27. }

  28. module.exports = BankVaultContract;

</pre>

注1:DepositContent在存储时,会把object转成字符串类型,在读取时,会取出相应字符串转成object。
注2:智能合约开始结尾的使用能节约时间,提高效率。

2.3tips

智能合约开发的特点

  • 上链数据不可更改
  • 数据透明,节点可以知道链上的所有数据
  • 不能得到真随机数,js的random()方法只能的都伪随机数
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,569评论 4 363
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,499评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,271评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,087评论 0 209
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,474评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,670评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,911评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,636评论 0 202
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,397评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,607评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,093评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,418评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,074评论 3 237
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,092评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,865评论 0 196
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,726评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,627评论 2 270

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,100评论 18 139
  • 单例模式 适用场景:可能会在场景中使用到对象,但只有一个实例,加载时并不主动创建,需要时才创建 最常见的单例模式,...
    Obeing阅读 2,017评论 1 10
  • New logo 创作你的创作 免费下载 以太坊学习 180 tenny1109 简书作者 2016.07.26 ...
    似曾相识2阅读 232评论 0 0
  • 它爬的很高; 找到别人家睡着。 漂浮的船时不时震荡; 巨浪说要了这条狗命; 云把它救起,瞳孔还流泪。 最后还不是死...
    佩恩灰阅读 298评论 0 0
  • 初冬 冷空气来袭 气温跳水 你 我 还有TA 都换上了 厚衣厚裤 唯有它们 依旧矗立在寒气里 清晨 看日出东方 落...
    FASHION_e018阅读 215评论 0 0