<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[两寸土编程]]></title> 
<description><![CDATA[不积跬步无以至千里；不积小流无以成江海。]]></description>
<link>https://www.liangcuntu.com/</link>
<language>zh-cn</language>
<generator>www.emlog.net</generator>
<item>
    <title>Ubuntu安装vscode web版 code-server</title>
    <link>https://www.liangcuntu.com/post/174</link>
    <description><![CDATA[<h2 id="h2-u4E0Bu8F7D"><a name="下载" class="reference-link"></a><span class="header-link octicon octicon-link"></span>下载</h2><p><a href="https://github.com/coder/code-server/releases/tag/v4.95.3">https://github.com/coder/code-server/releases/tag/v4.95.3</a><br>下载 code-server_4.95.3_amd64.deb
<h2 id="h2-u5B89u88C5"><a name="安装" class="reference-link"></a><span class="header-link octicon octicon-link"></span>安装</h2><pre><code class="lang-sh">dpkg -i code-server_4.90.2_amd64.deb
</code></pre>
<h2 id="h2-u9519u8BEF"><a name="错误" class="reference-link"></a><span class="header-link octicon octicon-link"></span>错误</h2><p>错误：code-server typeerror: cannot read property ‘split’ of undefined<br>解决：
<pre><code class="lang-sh">cd /usr/lib/code-server
npm i --unsafe-perm
</code></pre>
<p>错误：找不到配置文件 /root/..local/share/code-server/User/settings.json<br>解决：<code>touch .local/share/code-server/User/settings.json</code></p>
<p>错误：The workbench failed to connect to the server (Error: WebSocket close with status code 1006) Gitlab Web IDE<br>解决：websocket连接错误一般是nginx 代理问题
<pre><code class="lang-conf">#PROXY-START/

location ^~ /
{
    proxy_pass http://127.0.0.1:8080;
    #proxy_set_header Host 127.0.0.1;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    #proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;

    proxy_set_header Host $http_host;
    #proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection upgrade;
    proxy_set_header Accept-Encoding gzip;
    # proxy_hide_header Upgrade;

    add_header X-Cache $upstream_cache_status;
    #Set Nginx Cache

    set $static_file2kqaDKM8 0;
    if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
    {
        set $static_file2kqaDKM8 1;
        expires 1m;
    }
    if ( $static_file2kqaDKM8 = 0 )
    {
        add_header Cache-Control no-cache;
    }
}
#PROXY-END/
</code></pre>
<blockquote>
<blockquote>
<p>参考</p>
<ul>
<li><a href="https://blog.csdn.net/hbqst/article/details/140006329?sharetype=blog&amp;shareId=140006329&amp;sharerefer=APP&amp;sharesource=fffy2366&amp;sharefrom=link">https://blog.csdn.net/hbqst/article/details/140006329?sharetype=blog&amp;shareId=140006329&amp;sharerefer=APP&amp;sharesource=fffy2366&amp;sharefrom=link</a></li><li><a href="https://xxlab.tech/archives/code-server-wu-fa-da-kai-ipynb-wen-jian--bao-cuo-cryptosubtleisnotavailablesowebviewswillnotwork-de-jie-jue-fang-fa">code-server 无法打开ipynb文件，报错‘crypto.subtle‘ is not available so webviews will not work的解决方法</a></li></ul>
</blockquote>
</blockquote>]]></description>
    <pubDate>Sat, 23 Nov 2024 03:18:29 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/post/174</guid>

</item>
<item>
    <title>如何通过wifi将手机投屏到电脑并控制</title>
    <link>https://www.liangcuntu.com/post/173</link>
    <description><![CDATA[<p>将手机通过WiFi投屏到电脑并实现控制，可以使用多种方法和技术，这里以Android系统为例，提供一个通用步骤，并针对华为和小米手机给出具体的解决方案：</p>
<h2 id="h2--android-"><a name="通用方案（适用于大多数Android设备）：" class="reference-link"></a><span class="header-link octicon octicon-link"></span>通用方案（适用于大多数Android设备）：</h2><ol>
<li>确保网络环境：首先确保手机和电脑连接在同一Wi-Fi网络下。</li><li>启用无线显示功能：在手机上打开设置，找到“无线投屏”、“屏幕镜像”或“多屏互动”等类似选项（名称可能因不同品牌和型号而异）。</li><li>搜索并连接电脑：开启该功能后，手机会搜索可用的接收设备，选择你的电脑名称进行连接。部分情况下，可能需要在电脑端安装额外的接收软件，例如：Vysor、Scrcpy等。<h2 id="h2--"><a name="华为手机投屏及控制：" class="reference-link"></a><span class="header-link octicon octicon-link"></span>华为手机投屏及控制：</h2></li></ol>
<ul>
<li>使用EMUI系统内置的“多屏协同”或“无线投屏”功能，按照之前描述的通用步骤进行操作，即可将手机画面无线投射至电脑，并且部分情况下支持直接用鼠标和键盘对手机进行控制。<h2 id="h2--"><a name="小米手机投屏及控制：" class="reference-link"></a><span class="header-link octicon octicon-link"></span>小米手机投屏及控制：</h2></li><li>同样开启手机上的“无线显示”功能，搜索到电脑后建立连接。</li><li>若要实现控制，可以在电脑上安装如Scrcpy这样的工具，它允许用户通过USB或WiFi连接来控制安卓设备。对于WiFi连接，需先让手机和电脑处于同一局域网，并按照Scrcpy的指南运行服务端APK在手机上，然后在电脑端运行Scrcpy客户端程序，从而实现无线投屏与控制。<h2 id="h2--scrcpy-"><a name="具体步骤 - 使用Scrcpy无线控制：" class="reference-link"></a><span class="header-link octicon octicon-link"></span>具体步骤 - 使用Scrcpy无线控制：</h2></li></ul>
<ol>
<li>在手机上开启开发者选项并允许ADB调试（USB调试），并在其中启用无线ADB功能。</li><li>连接手机和电脑一次，通过USB启动ADB并执行命令使手机在Wi-Fi模式下可被识别（如adb tcpip 5555）。</li><li>断开USB线，在电脑上通过ADB连接手机的IP地址（如adb connect &lt;phone’s IP address&gt;:5555）。<br>另外可通过配对的方法：adb pair 192.168.1.<em>:<em>**</em></em><br>Enter pairing code: <strong>**</strong></li><li>运行Scrcpy客户端程序，此时应该能无线投屏并且通过键盘鼠标控制手机。<br>请注意，上述步骤可能会随着系统版本更新和软件更新有所变化，建议查阅最新版的相关文档或教程。</ol>]]></description>
    <pubDate>Fri, 02 Feb 2024 04:10:28 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/post/173</guid>

</item>
<item>
    <title>适用unicloud的抖音通用交易支付签名和验签nodejs代码</title>
    <link>https://www.liangcuntu.com/post/172</link>
    <description><![CDATA[<ol>
<li>签名：</li></ol>
<pre><code class="lang-js">// https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/industry/general_trade/create_order/requestOrder#87daf5bf
const createConfig = require('uni-config-center')
const shareConfig = createConfig({ // 获取配置实例
    pluginId: 'mymp-pay' // common/uni-config-center下的插件配置目录名
})
const payConfig = shareConfig.requireFile('config.js');
const getNotifyUrl = function (cloudInfo, payid, notify) {
    let notifyUrl = '';
    if (cloudInfo.provider == 'tencent') {
        notifyUrl = `https://${cloudInfo.spaceId}.service.tcloudbase.com/tt-pay/${notify}/${payid}`;
    } else if (cloudInfo.provider == 'aliyun') {
        notifyUrl = `https://fc-${cloudInfo.spaceId}.next.bspapp.com/tt-pay/${notify}/${payid}`;
    }
    return notifyUrl;
};
function getSignature(privateKeyStr, method, uri, timestamp, nonce, data) {
    const sign = crypto.createSign('SHA256');
    const rawStr = method + "\n" +
        uri + "\n" +
        timestamp + "\n" +
        nonce + "\n" +
        data + "\n";
    sign.update(rawStr);
    sign.end();
    const signature = sign.sign(privateKeyStr, 'base64');
    return signature;
}

function _getByteAuthorization(privateKeyStr, data, appId, nonceStr, timestamp, keyVersion) {
    try {
        const signature = getSignature(privateKeyStr, "POST", "/requestOrder", timestamp, nonceStr, data);
        const byteAuthorization = `SHA256-RSA2048 appid=${appId},nonce_str=${nonceStr},timestamp=${timestamp},key_version=${keyVersion},signature=${signature}`;
        return byteAuthorization;
    } catch (ex) {
        console.error(ex);
        return "";
    }
}
const getOrderData = function (out_order_no, skuId, title, price, image) {
    const cloudInfo = uniCloud.getCloudInfos()[0];
    const data = {
        skuList: [{
            skuId: skuId,
            title: title,
            price: price,
            quantity: 1,
            imageList: [image],
            type: 401, // 内容消费类商品
            tagGroupId: "tag_group_7272625659888041996", // 内容消费: 虚拟商品不支持退款
            entrySchema: {
                path: 'pages/index/index'
            }
        }],
        outOrderNo: out_order_no,
        totalAmount: price,
        payExpireSeconds: 0, // 支付超时时间，单位秒，例如 300 表示 300 秒后过期；不传或传 0 会使用默认值 300，不能超过48小时。
        payNotifyUrl: getNotifyUrl(cloudInfo, '', 'tt_callback'),
        orderEntrySchema: {
            path: 'pages/index/index'
        }
    }

    return JSON.stringify(data);
}    

/**
 * 签名
 * @param {string} data 
 * @returns 
 */
const getByteAuthorization = function (data) {    
    const privateKeyStr = payConfig.toutiao['mp-toutiao'].privateKey; // 从文件中读取私钥
    const timestamp = Math.floor(Date.now() / 1000);
    const appId = ttConfig.app_id;
    const nonceStr = uuidv4();
    const keyVersion = "1";

    const byteAuthorization = _getByteAuthorization(privateKeyStr, data, appId, nonceStr, timestamp, keyVersion);

    return byteAuthorization;
}
</code></pre>
<ol>
<li>验签：</li></ol>
<pre><code class="lang-js">// https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/server/signature-algorithm#%E7%AD%BE%E5%90%8D%E9%AA%8C%E8%AF%81
function verify(httpBody, publicKeyPem, signStr, timestamp, nonce) {
    const message = `${timestamp}\n${nonce}\n${httpBody}\n`;    

    // 使用RSA和SHA256进行验签
    const verifier = crypto.createVerify('RSA-SHA256');
    verifier.update(message);

    // 验证签名
    return verifier.verify(publicKeyPem, Buffer.from(signStr, 'base64'));
}

const httpInfo = this.getHttpInfo();
// uniCloud.logger.log(`httpInfo：`, httpInfo);
const bodyStr = httpInfo.body;
const nonce = httpInfo.headers['byte-nonce-str'];
const timestamp = httpInfo.headers['byte-timestamp'];
const signature = httpInfo.headers['byte-signature'];

const publicKey = payConfig.toutiao['mp-toutiao'].platformPublicKey;
if (!verify(bodyStr, publicKey, signature, timestamp, nonce)) {
    uniCloud.logger.log(`verify error`);
    return {
        mpserverlessComposedResponse: true,
        statusCode: 200,
        headers: {
            'content-type': 'application/json'
        },
        body: {
            "err_no": 1, //非0
            "err_tips": "verify error"  //非success
        }
    };
}
</code></pre>]]></description>
    <pubDate>Thu, 01 Feb 2024 03:32:02 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/post/172</guid>

</item>
<item>
    <title>内网穿透之frp</title>
    <link>https://www.liangcuntu.com/frp</link>
    <description><![CDATA[<p>frp配置参考<br><a href="https://github.com/fatedier/frp">frp</a></p>
<p>其他方式SSH，ngrok。<br>其中SSH需要autossh配合，windows稍微复杂了点<br>参考<br><a href="https://www.cnblogs.com/h46incon/archive/2016/03/29/5331433.html">Windows下使用AutoSSH，并作为服务自启动（不用安装Cygwin）
</a></p>
<p>ngrok参考 <a href="/raspi_ngrok">ngrok</a></p>
<p>另外windows开机启动把脚本放到shell:startup 目录重启后不登录不会执行脚本，所以需要加到计划任务，并设置不登录也运行。</p>]]></description>
    <pubDate>Sun, 23 Jan 2022 08:17:27 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/frp</guid>

</item>
<item>
    <title>Vue3 Debugging in VS Code</title>
    <link>https://www.liangcuntu.com/vue3_debugging_vscode</link>
    <description><![CDATA[<p>官方文档配置如下</p>
<pre><code>{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "vuejs: chrome",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "breakOnLoad": true,
      "sourceMapPathOverrides": {
        "webpack:///src/*": "${webRoot}/*"
      }
    },
    {
      "type": "firefox",
      "request": "launch",
      "name": "vuejs: firefox",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "pathMappings": [{ "url": "webpack:///src/", "path": "${webRoot}/" }]
    }
  ]
}
</code></pre><p>因为vscode版本升级，上面配置打断点后是灰色的不能调试，把配置改为如下</p>
<pre><code>{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息，请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}"
        }
    ]
}
</code></pre><p>另外用chrom dev版，vscode F5运行不能自动打开chrome</p>
<p><a href="https://v3.vuejs.org/cookbook/debugging-in-vscode.html#prerequisites">Debugging in VS Code</a></p>]]></description>
    <pubDate>Sun, 23 Jan 2022 07:47:38 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/vue3_debugging_vscode</guid>

</item>
<item>
    <title>错误消息- com.apple.DiskManagement.disenter 错误 49223</title>
    <link>https://www.liangcuntu.com/post/169</link>
    <description><![CDATA[<p>Mac 下磁盘工具装载USB移动硬盘报标题错误</p>
<p>会在使用格式化为 ExFAT 的硬盘时看到此错误消息。 在 macOS 和 Windows 之间切换使用硬盘时，应始终在 macOS 中格式化硬盘，因为 macOS 并不支持所有 Windows 分配单位大小（块大小）。不支持的分配单元大小将使硬盘无法安装。在尝试使用磁盘实用程序手动安装硬盘时，将会显示此错误。</p>
<p>如果您想要在 macOS 和 Windows 之间切换使用此硬盘，请备份硬盘上的所有重要数据，然后在 macOS 上重新将硬盘格式化为 ExFAT。您可在此处找到 ExFAT 格式的说明。</p>
<p>如果仅将此硬盘用于 macOS，请将硬盘重新格式化为 Mac OS 扩展（日志式），也称为 HFS+，以实现最佳兼容性。 您可在此处找到 HFS+ 格式的说明。 </p>
<blockquote>
<p>参考<a href="https://www.lacie.com/cn/zh/support/kb/disk-utility-errors-and-questions-for-macos-1011-and-higher-007820en/">https://www.lacie.com/cn/zh/support/kb/disk-utility-errors-and-questions-for-macos-1011-and-higher-007820en/</a></p>
</blockquote>]]></description>
    <pubDate>Tue, 12 Oct 2021 03:05:47 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/post/169</guid>

</item>
<item>
    <title>mac 下git pull ssh://... 出错</title>
    <link>https://www.liangcuntu.com/git_pull_ssh_err</link>
    <description><![CDATA[<p>问题：git pull 出错</p>
<p>GitLab: The project you were looking for could not be found.<br>fatal: Could not read from remote repository.
<p>Please make sure you have the correct access rights<br>and the repository exists.
<p>原因：最近安装了SecureCRT，用非默认私钥登录SSH导致默认私钥被替换。</p>
<p>解决：SecureCRT私钥设置成系统默认的~/.ssh/id_rsa</p>]]></description>
    <pubDate>Sun, 10 Oct 2021 08:40:54 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/git_pull_ssh_err</guid>

</item>
<item>
    <title>mac 安装java8</title>
    <link>https://www.liangcuntu.com/post/167</link>
    <description><![CDATA[<h2 id="h2-u5DF2u5B89u88C5"><a name="已安装" class="reference-link"></a><span class="header-link octicon octicon-link"></span>已安装</h2><ul>
<li>Homebrew 3.2.14</li><li>jenv4.4</li><li>java7</li></ul>
<h2 id="h2--java8"><a name="安装java8" class="reference-link"></a><span class="header-link octicon octicon-link"></span>安装java8</h2><p>下载安装包，需要oracle账号<a href="https://www.oracle.com/java/technologies/downloads/#java8-mac">https://www.oracle.com/java/technologies/downloads/#java8-mac</a></p>
<p>安装后路径</p>
<pre><code class="lang-sh">jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home

#There is already a 1.8 JDK managed by jenv
#Do you want to override (type y to confirm)? y

jenv global 1.8
# 切换版本
jenv local 1.8
#查看版本
java -version
</code></pre>
<blockquote>
<blockquote>
<p>参考<br><a href="https://www.jianshu.com/p/b03eeb98e2ab">Mac 下Java多版本管理工作：Jenv</a><br><a href="https://www.jianshu.com/p/8f53fbdb2180">mac使用brew安装Java8
</a><br><a href="https://blog.csdn.net/huawen6/article/details/89182965">mac笔记本安装JDK8
</a></p>
</blockquote>
</blockquote>]]></description>
    <pubDate>Sat, 02 Oct 2021 03:11:45 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/post/167</guid>

</item>
<item>
    <title>合约入门</title>
    <link>https://www.liangcuntu.com/post/166</link>
    <description><![CDATA[<h2 id="h2-solidity-solidity-0-6-12-"><a name="solidity入门 官方文档 (solidity目前采用版本0.6.12)" class="reference-link"></a><span class="header-link octicon octicon-link"></span>solidity入门 官方文档 (solidity目前采用版本0.6.12)</h2><p><a href="https://solidity-cn.readthedocs.io/zh/develop/">https://solidity-cn.readthedocs.io/zh/develop/</a></p>
<h2 id="h2--truffle-ganache-web3-js-"><a name="开发套件一： truffle ganache web3.js文档" class="reference-link"></a><span class="header-link octicon octicon-link"></span>开发套件一： truffle ganache web3.js文档</h2><p><a href="https://www.trufflesuite.com/ganache">https://www.trufflesuite.com/ganache</a><br><a href="https://www.trufflesuite.com/">https://www.trufflesuite.com/</a><br><a href="https://web3js.readthedocs.io/en/v1.3.4/">https://web3js.readthedocs.io/en/v1.3.4/</a></p>
<h2 id="h2--hardhat-ethers-js-"><a name="开发套件二：hardhat ethers.js文档（目前开发采用）" class="reference-link"></a><span class="header-link octicon octicon-link"></span>开发套件二：hardhat ethers.js文档（目前开发采用）</h2><p><a href="https://hardhat.org/getting-started/#installation">https://hardhat.org/getting-started/#installation</a><br><a href="https://docs.ethers.io/v5/">https://docs.ethers.io/v5/</a></p>
<p>学习hardhat的入门例子，在测试网络发布合约发一个ERC20币，运行单元测试</p>
<h2 id="h2-erc20-erc721-erc1155-"><a name="erc20 erc721 erc1155 标准学习" class="reference-link"></a><span class="header-link octicon octicon-link"></span>erc20 erc721 erc1155 标准学习</h2><p><a href="OpenZeppelin">OpenZeppelin的智能合约代码库</a>是以太坊开发者的宝库，OpenZeppelin代码库包含了经过社区审查的ERC代币标准、安全协议以及很多的辅助工具库，这些代码可以帮助开发者专注业务逻辑的，而无需重新发明轮子。</p>
<p>基于OpenZeppelin开发合约，即可以提高代码的安全性，又可以提高开发效率。</p>
<p>参考： <a href="https://github.com/OpenZeppelin/openzeppelin-contracts">openzeppelin</a></p>
<pre><code class="lang-json">"dependencies": {
    "@openzeppelin/contracts": "^3.1.0",
  }
</code></pre>
<h2 id="h2--hardhat-web3-vue-demo"><a name="前端 hardhat+web3+vue DEMO" class="reference-link"></a><span class="header-link octicon octicon-link"></span>前端 hardhat+web3+vue DEMO</h2><p><a href="https://github.com/remote-gildor/hardhat-web3-vue-starter">https://github.com/remote-gildor/hardhat-web3-vue-starter</a></p>
<h2 id="h2-ide"><a name="IDE" class="reference-link"></a><span class="header-link octicon octicon-link"></span>IDE</h2><p><a href="https://remix.ethereum.org/">https://remix.ethereum.org/</a> 或<br>vscode + solidity 插件
<h2 id="h2-bsc-"><a name="BSC 网络" class="reference-link"></a><span class="header-link octicon octicon-link"></span>BSC 网络</h2><h3 id="h3-u6DFBu52A0u4E3Bu7F51u8282u70B9"><a name="添加主网节点" class="reference-link"></a><span class="header-link octicon octicon-link"></span>添加主网节点</h3><p>访问 <a href="https://pancakeswap.finance/">https://pancakeswap.finance/</a> 可以添加</p>
<h3 id="h3-u6D4Bu8BD5u7F51u8282u70B9"><a name="测试网节点" class="reference-link"></a><span class="header-link octicon octicon-link"></span>测试网节点</h3><p>名称： BSC Testnet<br>RPC URL：<a href="https://data-seed-prebsc-1-s1.binance.org:8545">https://data-seed-prebsc-1-s1.binance.org:8545</a><br>节点ID：97<br>符号： BNB<br>区块链浏览器：<a href="https://testnet.bscscan.com/">https://testnet.bscscan.com/</a></p>
<h3 id="h3-u9886u6D4Bu8BD5u5E01"><a name="领测试币" class="reference-link"></a><span class="header-link octicon octicon-link"></span>领测试币</h3><p><a href="http://testnet.binance.org/faucet-smart">http://testnet.binance.org/faucet-smart</a></p>]]></description>
    <pubDate>Sat, 24 Jul 2021 08:10:59 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/post/166</guid>

</item>
<item>
    <title>DeFi入门</title>
    <link>https://www.liangcuntu.com/defi</link>
    <description><![CDATA[<h1 id="h1-defi-"><a name="DeFi入门" class="reference-link"></a><span class="header-link octicon octicon-link"></span>DeFi入门</h1><h2 id="h2--defi-decentralized-finance-di-sentr-la-zd-fa-n-ns-"><a name="什么是 DeFi Decentralized Finance [ˌdiːˈsentrəlaɪzd] [ˈfaɪnæns]" class="reference-link"></a><span class="header-link octicon octicon-link"></span>什么是 DeFi Decentralized Finance [ˌdiːˈsentrəlaɪzd] [ˈfaɪnæns]</h2><p>那么具体来说，DeFi 是什么？它一般是指基于智能合约平台（例如以太坊）构建的加密资产、金融类智能合约以及协议。</p>
<p>在过去几个月中，去中心化金融—以“ DeFi ”广为人知—看起来已经成为了以太坊的杀手级用例。</p>
<h2 id="h2-tvl-total-value-locked-"><a name="TVL （Total Value Locked ）" class="reference-link"></a><span class="header-link octicon octicon-link"></span>TVL （Total Value Locked ）</h2><p>锁定总价值（TVL）是衡量 DeFi 使用规模重要度量方式之一，通过计算所有锁定在 ETH，TRX，EOS 等公链智能合约中的所有代币价值的总价值（美元）之和而得到。</p>
<p>2020 年上半年 DeFi 生态中 TVL 增加 10 亿美元，半年增长 147%，且此增长速率有望保持<br>Aave 不到一年从 0 增长到 30 亿美元
<h2 id="h2-defi-"><a name="DeFi 项目" class="reference-link"></a><span class="header-link octicon octicon-link"></span>DeFi 项目</h2><p>去中心化稳定币、借贷、交易所、衍生品、资金管理、彩票、支付、保险</p>
<p><a href="https://defi.chaindd.com/#/">https://defi.chaindd.com/#/</a></p>
<h2 id="h2-makerdao"><a name="MakerDao" class="reference-link"></a><span class="header-link octicon octicon-link"></span>MakerDao</h2><p>治理代币 MKR<br>缺乏足够庞大且有价值的治理场景，DeFi 很可能重蹈数字资产行业历史上出现了各种“昙花一现”情况。<br>Dai<br>“Dai 存款利率（Dai Savings Rate, DSR）” 的 Maker 协议功能，把 Dai 转入储蓄账户。<br>2021.2.12 Dai 发行量突破 20 亿！
<p>Whiterpaper : <a href="https://makerdao.com/en/whitepaper/">https://makerdao.com/en/whitepaper/</a><br>开发文档： <a href="https://docs.makerdao.com/">https://docs.makerdao.com/</a></p>
<h2 id="h2-aave-"><a name="aave 开源去中心化借贷协议:" class="reference-link"></a><span class="header-link octicon octicon-link"></span>aave 开源去中心化借贷协议:</h2><p>目前 Aave 是去中心化融资领域最受欢迎的贷款协议之一，而它的最初版本是于 2017 年问世的。在 2018 年 9 月晚些时候重新命名之前，该项目被称为 ETHLend。<br>开始点对点模型，许多其他项目，如 Uniswap 和 Compound 于 2018 年底成立，他们开始用另一种模式 — 点对合约。
<p>超额抵押，提供的抵押品的价值需要高于可以借出的金额。这保护了协议面授抵押资金不足和无力偿还出乎的影响。<br>存款得 aToken，aToken = 存款加利息
<h2 id="h2-compound"><a name="Compound" class="reference-link"></a><span class="header-link octicon octicon-link"></span>Compound</h2><p>Compound Finance 是一个基于以太坊的开源货币市场协议，任何人都可以在其中无摩擦地提供或借入加密货币。截至 2020 年 2 月，7 种不同的代币在 Compound 平台上有提供或可以用作抵押品，包括注意力币（BAT）、Dai（DAI）、以太币（ETH）、Augur（REP）、USD Coin （USDC）、Wrapped Bitcoin（WBTC）以及 0x（ZRX）。<br><a href="https://app.compound.finance">https://app.compound.finance</a></p>
<h2 id="h2-uniswap"><a name="Uniswap" class="reference-link"></a><span class="header-link octicon octicon-link"></span>Uniswap</h2><p>Uniswap 交易所是一个建立在以太坊上的去中心化代币交易所协议，允许用户直接交换代币而无需使用中心化交易所。当使用中心化交易所时，你将需要将代币存入交易所，在订单薄上提交订单，然后提取换取的代币。</p>
<h2 id="h2-yearn"><a name="yearn" class="reference-link"></a><span class="header-link octicon octicon-link"></span>yearn</h2><p>yearn 是一个聚合理财平台。 yearn (原名 iearn) 平台聚合 Compound、dYdX、Aave、DDEX 协议，用户存款时，平台会将资金自动分配至目前收益最高的协议下。</p>
<p>然后 yearn 会给用户一个称为 yToken 的权益证明，用户可以通过 ytoken 取出自己原来存入的代币及相应的收益。<br>同时，yearn 还与 Curve 合作推出了 y.curve.fi 这个稳定币兑换池，yToken 的持有者除了可以享受到原有的借贷理财收益之外。<br>还可以再把 yToken 存入 y.curve.fi 的兑换池中，就可以成为兑换池的稳定币做市商，额外享受到做市收益。<br>这样子的一个组合提供了目前所有 DeFi 平台中最高的稳定币理财收益。 yearn 已正式推出新机枪池 yETH 及 yWETH 等，你可以通过抵押以太坊等代币来获得被动收益。<br>目前，yearn 平台已支持如 DAI、USDC、USDT、TUSD、sUSD、BUSD 在内的多种稳定币的理财服务。 yearn 已发行治理代币 YFI。yearn 已参加 Nexus Mutual 的智能合约保险。<br>官网： <a href="https://yearn.finance/">https://yearn.finance/</a><br>文档： <a href="https://docs.yearn.finance/">https://docs.yearn.finance/</a></p>
<p>开源：<br><a href="https://github.com/iearn-finance/iearn-finance">https://github.com/iearn-finance/iearn-finance</a><br><a href="https://github.com/iearn-finance/yearn-vaults">https://github.com/iearn-finance/yearn-vaults</a><br><a href="https://github.com/iearn-finance/yearn-protocol">https://github.com/iearn-finance/yearn-protocol</a></p>
<h2 id="h2-yfii"><a name="YFII" class="reference-link"></a><span class="header-link octicon octicon-link"></span>YFII</h2><p>YFII 不是 YFI 的仿盘，而是分叉盘。</p>
<p>简单来讲，这就是一个聚合挖矿套利的产品。</p>
<h2 id="h2-curve-"><a name="Curve 是什么?" class="reference-link"></a><span class="header-link octicon octicon-link"></span>Curve 是什么?</h2><p>Curve 是基于以太坊的去中心化稳定币交易池，其特点在于高效而低滑点的稳定币交易体验，以及为做市商提供低风险的手续费收入。在后台，流动性池中持有的代币也将提供给 Compound 协议或 iearn.finance，在此处为流动性提供者产生更多的收入。<br><a href="https://www.curve.fi/">https://www.curve.fi/</a></p>
<h2 id="h2-pooltogether-"><a name="PoolTogether: 保本博彩游戏。" class="reference-link"></a><span class="header-link octicon octicon-link"></span>PoolTogether: 保本博彩游戏。</h2><h2 id="h2--nft-non-fungible-token-"><a name="非同质化代币（NFT， Non-fungible token) 指的是一类具有唯一性的数字资产。" class="reference-link"></a><span class="header-link octicon octicon-link"></span>非同质化代币（NFT， Non-fungible token) 指的是一类具有唯一性的数字资产。</h2><p>DEGO 代币作为 DEGO 生态的底层资产主要用于用户抵押及治理。除了预售及空投外，用户只能通过流动性挖矿获取 DEGO。<br>DEGO 链
<p>DEGO 链将基于 Substrate 框架进行开发，并最终成为波卡生态中的一条平行链。得益于 XCMP 跨链协议，用户可以使用其他链上的加密资产与 DEGO 生态进行交互。DEGO 将与其他生态一同搭建跨链 DeFi 的世界。<br><a href="https://dego.finance/home">https://dego.finance/home</a></p>
<p><a href="http://subdev.cn/">Substrate 开发框架</a></p>
<p><a href="https://baijiahao.baidu.com/s?id=1678789576095189669&amp;wfr=spider&amp;for=pc">DEGO：乐高积木拼凑出的 DeFi 世界｜项目介绍</a></p>
<h2 id="h2-swft"><a name="SWFT" class="reference-link"></a><span class="header-link octicon octicon-link"></span>SWFT</h2><p>Smart Worldwide Financial Technology</p>
<p>SwftCoin (速币)是 SWFT Blockchain 跨链去中心化(DeFi)的币币兑换平台(swap)的平台币，用于 SWFT Pay 聚合支付网络清算、聚合交易平台交易手续费和交易区。SWFT 支持 DeFi 与 CeFi 两大币币兑换方式，兼具中心化和去中心化两种钱包模式，同时支持去中心化支付，以及在全球主流社区媒体发数字货币红包，包括微信、Twitter、Facebook、Telegram 等。独有的跨链算法融合了区块链与人工智能，专利申请已被美国专利局 USPTO 受理，可实现任意币种两两兑换，并自动获取最优价。</p>
<p>SWFT 由美国硅谷一线风投 Draper Dragon 等投资，其跨链闪兑 API 已植入包括 Ledger、麦子、Tokenpocket、Ellipal、Atoken、MYKEY 等在内的全球几十个钱包，并与 Circle Centre、Dash、Hydro、Tron 等 200 余业界生态进行深入合作。SWFT 是加州伯克利大学区块链加速器首批毕业项目，曾荣获深圳创业创新大赛金融科技赛等多项赛事冠军。</p>
<p>ISWFT 平台代币 SwftCoin (速币)，是最早的 DeFi 概念平台币，已上线多个一线交易平台。</p>
<h2 id="h2-bancor"><a name="Bancor" class="reference-link"></a><span class="header-link octicon octicon-link"></span>Bancor</h2><p>Bancor 是一种去中心化交换协议，允许创建流动资金池来交易资产。<br>Bancor 由旨在执行算法代币交易和链上流动资金池化的智能合约（即“流动资金池”）组成。支持 ERC20 代币和 EOS 代币的 Bancor 可以在以太坊网络和 EOS 网络上实现流动资金池曲线。<br>价格确定方法：存入协议的代币储备余额除以代币的总供应量，然后乘以储备比率。<br>BNT 为 Bancor 协议代币。当用户创建 Bancor 池或在其中进行质押时，用户需要以等价值的 ERC20 代币+BNT（或 EDS 代币+BNT）进行创建或质押。此外，BNT 还可以提供跨链转换和积极的网络效应；并且预计将于 2020 年第 2 季度将其用于权益质押。<br>2020 年 1 月 1 日，为 BNT 代币持有者隔空投送了 ETHBNT 代币。ETHBNT 代币表示可以代表 ETH 股份的 Bancor 池代币：BNT 流动资金池，即这些代币针对 Bancor 之上基于 ETH 的转换收取费用。
<h2 id="h2-u5F00u53D1u73AFu5883"><a name="开发环境" class="reference-link"></a><span class="header-link octicon octicon-link"></span>开发环境</h2><p>solidity ， Vyper</p>
<p>什么是 Vyper<br>Vyper 是一种应用于以太坊虚拟机（EVM）上的面向合约的 python 风格的编程语言。Vyper 代码编译成字节码后在 EVM 上运行。
<p>Vyper 语言最主要的特点是简单和安全。它的出现主要是针对 Solidity 语言编写合约时难于阅读（或编写）和安全性较差的问题，从语言层次上作出了一些改进和支持，并抛弃了 Solidity 中一些复杂的特性。它虽然使用 python 风格的语法，但其实际上是由 Serpent 语言升级而来。</p>
<p><a href="https://viper.readthedocs.io/en/latest/">Vyper</a></p>
<p>在线 IDE: <a href="https://ethereum.github.io/browser-solidity/">https://ethereum.github.io/browser-solidity/</a></p>
<p><a href="https://github.com/ethereum/wiki/wiki/[%E4%B8%AD%E6%96%87]-Serpent%E6%8C%87%E5%8D%97">[中文] Serpent 指南</a></p>]]></description>
    <pubDate>Sun, 28 Feb 2021 03:53:58 +0000</pubDate>
    <author>Frank</author>
    <guid>https://www.liangcuntu.com/defi</guid>

</item></channel>
</rss>