更改Google Chrome 用户文件存储目录User Data 最简单方法
当前位置正文更改Google Chrome 用户文件存储目录User Data 最简单方法 1.在你想要存放数据的盘符下创建文件夹,假设为E:\Google\Chrome 2.把已经存在的User Data数据复制到E:\Google\Chrome中 3.开始->附件->命令提示符(右键以管理员身份运行) 4.输入CD C:\Users\你的用户名\AppData\Local\Google\Chrome 5.输入RMDIR /S “User Data”,提示是否删除输入Y 6.输入MKLINK /J “User Data” “E:\Google\Chrome” 7.重启浏览器,大功告成。
a16z领投3000万美元的去中心化社交协议Farcaster教程
Step 1: 设置环境在编写代码之前,您需要设置一个 Node.js 环境,推荐使用 replit ,它是一个基于 IDE 进行编程的浏览器。 1.在 repli 上注册一个免费帐户并登录; 2.点击左上角的create创建;3.出现提示时选择 Node.js,然后点击Create Repl。还需要一个以太坊节点来与 Facaster Registry 合约对话。 建议使用 Alchemy 。 如果您是第一次注册,以下步骤可能会略有不同: 1.注册 Alchemy.com ,并登录。2.选择以太坊作为区块链,点击get started。3.team name和app name随便取,网络选择Rinkeby,点击Create APP。4.选择第一个免费的,点击continue。5.点击跳过。6.继续点击跳过。7.点击continue。8.随便输入什么,点击let‘s go。9.点击view details。10.点击view key。11.找到HTTP的URL,复制v2/后面那部分代码,将其保存在某个地方。12.切换回 Replit 并转到右侧窗格中的 Shell 选项卡并运行以...

Subscribe to andrecronje
更改Google Chrome 用户文件存储目录User Data 最简单方法
当前位置正文更改Google Chrome 用户文件存储目录User Data 最简单方法 1.在你想要存放数据的盘符下创建文件夹,假设为E:\Google\Chrome 2.把已经存在的User Data数据复制到E:\Google\Chrome中 3.开始->附件->命令提示符(右键以管理员身份运行) 4.输入CD C:\Users\你的用户名\AppData\Local\Google\Chrome 5.输入RMDIR /S “User Data”,提示是否删除输入Y 6.输入MKLINK /J “User Data” “E:\Google\Chrome” 7.重启浏览器,大功告成。
a16z领投3000万美元的去中心化社交协议Farcaster教程
Step 1: 设置环境在编写代码之前,您需要设置一个 Node.js 环境,推荐使用 replit ,它是一个基于 IDE 进行编程的浏览器。 1.在 repli 上注册一个免费帐户并登录; 2.点击左上角的create创建;3.出现提示时选择 Node.js,然后点击Create Repl。还需要一个以太坊节点来与 Facaster Registry 合约对话。 建议使用 Alchemy 。 如果您是第一次注册,以下步骤可能会略有不同: 1.注册 Alchemy.com ,并登录。2.选择以太坊作为区块链,点击get started。3.team name和app name随便取,网络选择Rinkeby,点击Create APP。4.选择第一个免费的,点击continue。5.点击跳过。6.继续点击跳过。7.点击continue。8.随便输入什么,点击let‘s go。9.点击view details。10.点击view key。11.找到HTTP的URL,复制v2/后面那部分代码,将其保存在某个地方。12.切换回 Replit 并转到右侧窗格中的 Shell 选项卡并运行以...
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
估值102亿融资5.45亿的Alchemy 项目,大学每周任务逐步开始。持有大学生早期卡的伙伴们可以开始大学生活了:
官方大佬的 lens ,可以关注下:
了解更多,请关注作者:https://twitter.com/bitc2024
部分章节是看文章和视频的,自行查看哈,这里从实际操作开始。
1: Transaction Output
查看要求:

输入:
class TXO {
constructor(owner, amount) {
this.owner = owner;
this.amount = amount;
this.spent = false;
}
spend() {
this.spent = true;
}
}
module.exports = TXO;
点击运行。
2: Spent TXOs\ 查看要求:

输入:
class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
}
}
module.exports = Transaction;
点击运行。
3: Sufficient Amount
查看要求:

class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
let inn = 0;
for (let i = 0; i < this.inputUTXOs.length; i++) {
inn = inn + this.inputUTXOs[i].amount;
}
let out = 0;
for (let i = 0; i < this.outputUTXOs.length; i++) {
out = out + this.outputUTXOs[i].amount;
}
if (inn < out) {
throw new Error("less than");
}
}
}
module.exports = Transaction;
点击运行。
4: Successful Execute
查看要求:

输入:
class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
let inn = 0;
for (let i = 0; i < this.inputUTXOs.length; i++) {
inn = inn + this.inputUTXOs[i].amount;
}
let out = 0;
for (let i = 0; i < this.outputUTXOs.length; i++) {
out = out + this.outputUTXOs[i].amount;
}
if (inn < out) {
throw new Error("less than");
}
for (let i = 0; i < this.inputUTXOs.length; i++) {
this.inputUTXOs[i].spend();
}
}
}
module.exports = Transaction;
点击运行。
5: Miner's Fee
查看要求:

输入:
class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
let inn = 0;
for (let i = 0; i < this.inputUTXOs.length; i++) {
inn = inn + this.inputUTXOs[i].amount;
}
let out = 0;
for (let i = 0; i < this.outputUTXOs.length; i++) {
out = out + this.outputUTXOs[i].amount;
}
if (inn < out) {
throw new Error("less than");
}
for (let i = 0; i < this.inputUTXOs.length; i++) {
this.inputUTXOs[i].spend();
}
this.fee = inn - out;
}
}
module.exports = Transaction;
点击运行。
1: Node
查看要求:

输入:
class Node {
constructor(data) {
this.data = data;
this.left = null;
this.right = null;
}
}
module.exports = Node;
点击运行。
2: Tree
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
}
module.exports = Tree;
点击运行。
3: Add Root
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
this.root = node;
}
}
module.exports = Tree;
点击运行。
4: First Layer
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
if (this.root === null) {
this.root = node;
} else if (this.root.data > node.data) {
this.root.left = node;
} else {
this.root.right = node;
}
}
}
module.exports = Tree;
点击运行。
5: Many Layers
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
if (this.root === null) {
this.root = node;
} else {
let p = this.root;
while (true) {
if (p.data > node.data) {
if (p.left) {
p = p.left;
} else {
p.left = node;
break;
}
} else {
if (p.right) {
p = p.right;
} else {
p.right = node;
break;
}
}
}
}
}
}
module.exports = Tree;
点击运行。
6: Search
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
if (this.root === null) {
this.root = node;
} else {
let p = this.root;
while (true) {
if (p.data > node.data) {
if (p.left) {
p = p.left;
} else {
p.left = node;
break;
}
} else {
if (p.right) {
p = p.right;
} else {
p.right = node;
break;
}
}
}
}
}
hasNode(number) {
let n = this.root;
while(n) {
if (n.data === number) {
return true;
} else {
if (n.data > number) {
n = n.left;
} else {
n = n.right;
}
}
}
return false;
}
}
module.exports = Tree;
点击运行。
1: Combine Two Leaves
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot() {
return this.concat(this.leaves[0], this.leaves[1]);
}
}
module.exports = MerkleTree;
点击运行。
2: Multiple Layers
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot(next = this.leaves) {
while(true) {
if (next.length <= 1) {
return next;
}
let level = [];
for (let i = 0; i < next.length; i+=2) {
level.push(this.concat(next[i], next[i+1]));
}
next = level;
}
}
}
module.exports = MerkleTree;
点击运行。
3: Odd Leaves
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot(next = this.leaves) {
while (true) {
if (next.length <= 1) {
return next;
}
let level = [];
for (let i = 0; i < next.length; i += 2) {
if ((i + 1) >= next.length) {
level.push(next[i]);
} else {
level.push(this.concat(next[i], next[i + 1]));
}
}
next = level;
}
}
}
module.exports = MerkleTree;
点击运行。
4: Build the Proof
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot(next = this.leaves) {
while (true) {
if (next.length <= 1) {
return next;
}
let level = [];
for (let i = 0; i < next.length; i += 2) {
if ((i + 1) >= next.length) {
level.push(next[i]);
} else {
level.push(this.concat(next[i], next[i + 1]));
}
}
next = level;
}
}
getProof(index, next = this.leaves){
let proof = [];
while (true) {
if (next.length <= 1) {
return proof;
}
let level = [];
for (let i = 0; i < next.length; i += 2) {
if ((i + 1) >= next.length) {
level.push(next[i]);
} else {
level.push(this.concat(next[i], next[i + 1]));
if (index === i || i === (index - 1)) {
if (index === i) {
proof.push({data:next[i + 1], left:false});
} else {
proof.push({data:next[i], left:true});
}
}
}
}
index = Math.floor(index/2);
next = level;
}
}
}
module.exports = MerkleTree;
点击运行。
5: Verify your Proof
查看要求:

输入:
function verifyProof(proof, node, root, concat) {
let n = node;
proof.forEach((e,_) => {
if (e.left) {
n = concat(e.data, n);
} else {
n = concat(n, e.data);
}
});
if (n === root) {
return true;
} else {
return false;
}
}
module.exports = verifyProof;
点击运行。
1: Constructors
查看要求:

这里注意要改两个文件:

class TrieNode {
constructor(key) {
this.key = key;
this.children = {};
this.isWord = false;
}
}
module.exports = TrieNode;

const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
}
module.exports = Trie;
点击运行。
2: Insert
查看要求:

输入:
这里注意改第二个文件:

const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
insert(data) {
let n = this.root;
for (let i = 0; i < data.length; i++) {
let node = new TrieNode(data[i]);
n.children[data[i]] = node;
if ((i + 1) === data.length) {
node.isWord = true;
}
n = node;
}
}
}
module.exports = Trie;
点击运行。
3: Insert Branching
查看要求:

这里还是改这个文件:

输入:
const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
insert(data) {
let n = this.root;
for (let i = 0; i < data.length; i++) {
let node = n.children[data[i]];
if (! node) {
node = new TrieNode(data[i]);
}
n.children[data[i]] = node;
if ((i + 1) === data.length) {
node.isWord = true;
}
n = node;
}
}
}
module.exports = Trie;
点击运行。
4: Contains
查看要求:


还是改这个文件,输入:
const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
insert(data) {
let n = this.root;
for (let i = 0; i < data.length; i++) {
let node = n.children[data[i]];
if (! node) {
node = new TrieNode(data[i]);
}
n.children[data[i]] = node;
if ((i + 1) === data.length) {
node.isWord = true;
}
n = node;
}
}
contains(word) {
let n = this.root.children[word[0]];
if (n === null) {
return false;
}
let i = 1;
while(n) {
if (i >= word.length) {
if (n.isWord) {
return true;
} else {
return false;
}
}
n = n.children[word[i]];
if (n === null) {
return false;
}
i = i + 1;
}
}
}
module.exports = Trie;
点击运行。
以上,Blockchain Storage,课程学习完成。
未完待续……
了解更多,请关注作者:https://twitter.com/bitc2024
估值102亿融资5.45亿的Alchemy 项目,大学每周任务逐步开始。持有大学生早期卡的伙伴们可以开始大学生活了:
官方大佬的 lens ,可以关注下:
了解更多,请关注作者:https://twitter.com/bitc2024
部分章节是看文章和视频的,自行查看哈,这里从实际操作开始。
1: Transaction Output
查看要求:

输入:
class TXO {
constructor(owner, amount) {
this.owner = owner;
this.amount = amount;
this.spent = false;
}
spend() {
this.spent = true;
}
}
module.exports = TXO;
点击运行。
2: Spent TXOs\ 查看要求:

输入:
class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
}
}
module.exports = Transaction;
点击运行。
3: Sufficient Amount
查看要求:

class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
let inn = 0;
for (let i = 0; i < this.inputUTXOs.length; i++) {
inn = inn + this.inputUTXOs[i].amount;
}
let out = 0;
for (let i = 0; i < this.outputUTXOs.length; i++) {
out = out + this.outputUTXOs[i].amount;
}
if (inn < out) {
throw new Error("less than");
}
}
}
module.exports = Transaction;
点击运行。
4: Successful Execute
查看要求:

输入:
class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
let inn = 0;
for (let i = 0; i < this.inputUTXOs.length; i++) {
inn = inn + this.inputUTXOs[i].amount;
}
let out = 0;
for (let i = 0; i < this.outputUTXOs.length; i++) {
out = out + this.outputUTXOs[i].amount;
}
if (inn < out) {
throw new Error("less than");
}
for (let i = 0; i < this.inputUTXOs.length; i++) {
this.inputUTXOs[i].spend();
}
}
}
module.exports = Transaction;
点击运行。
5: Miner's Fee
查看要求:

输入:
class Transaction {
constructor(inputUTXOs, outputUTXOs) {
this.inputUTXOs = inputUTXOs;
this.outputUTXOs = outputUTXOs;
}
execute() {
for (let i = 0; i < this.inputUTXOs.length; i++) {
if (this.inputUTXOs[i].spent) {
throw new Error("already spent");
}
}
let inn = 0;
for (let i = 0; i < this.inputUTXOs.length; i++) {
inn = inn + this.inputUTXOs[i].amount;
}
let out = 0;
for (let i = 0; i < this.outputUTXOs.length; i++) {
out = out + this.outputUTXOs[i].amount;
}
if (inn < out) {
throw new Error("less than");
}
for (let i = 0; i < this.inputUTXOs.length; i++) {
this.inputUTXOs[i].spend();
}
this.fee = inn - out;
}
}
module.exports = Transaction;
点击运行。
1: Node
查看要求:

输入:
class Node {
constructor(data) {
this.data = data;
this.left = null;
this.right = null;
}
}
module.exports = Node;
点击运行。
2: Tree
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
}
module.exports = Tree;
点击运行。
3: Add Root
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
this.root = node;
}
}
module.exports = Tree;
点击运行。
4: First Layer
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
if (this.root === null) {
this.root = node;
} else if (this.root.data > node.data) {
this.root.left = node;
} else {
this.root.right = node;
}
}
}
module.exports = Tree;
点击运行。
5: Many Layers
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
if (this.root === null) {
this.root = node;
} else {
let p = this.root;
while (true) {
if (p.data > node.data) {
if (p.left) {
p = p.left;
} else {
p.left = node;
break;
}
} else {
if (p.right) {
p = p.right;
} else {
p.right = node;
break;
}
}
}
}
}
}
module.exports = Tree;
点击运行。
6: Search
查看要求:

输入:
class Tree {
constructor() {
this.root = null;
}
addNode(node) {
if (this.root === null) {
this.root = node;
} else {
let p = this.root;
while (true) {
if (p.data > node.data) {
if (p.left) {
p = p.left;
} else {
p.left = node;
break;
}
} else {
if (p.right) {
p = p.right;
} else {
p.right = node;
break;
}
}
}
}
}
hasNode(number) {
let n = this.root;
while(n) {
if (n.data === number) {
return true;
} else {
if (n.data > number) {
n = n.left;
} else {
n = n.right;
}
}
}
return false;
}
}
module.exports = Tree;
点击运行。
1: Combine Two Leaves
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot() {
return this.concat(this.leaves[0], this.leaves[1]);
}
}
module.exports = MerkleTree;
点击运行。
2: Multiple Layers
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot(next = this.leaves) {
while(true) {
if (next.length <= 1) {
return next;
}
let level = [];
for (let i = 0; i < next.length; i+=2) {
level.push(this.concat(next[i], next[i+1]));
}
next = level;
}
}
}
module.exports = MerkleTree;
点击运行。
3: Odd Leaves
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot(next = this.leaves) {
while (true) {
if (next.length <= 1) {
return next;
}
let level = [];
for (let i = 0; i < next.length; i += 2) {
if ((i + 1) >= next.length) {
level.push(next[i]);
} else {
level.push(this.concat(next[i], next[i + 1]));
}
}
next = level;
}
}
}
module.exports = MerkleTree;
点击运行。
4: Build the Proof
查看要求:

输入:
class MerkleTree {
constructor(leaves, concat) {
this.leaves = leaves;
this.concat = concat;
}
getRoot(next = this.leaves) {
while (true) {
if (next.length <= 1) {
return next;
}
let level = [];
for (let i = 0; i < next.length; i += 2) {
if ((i + 1) >= next.length) {
level.push(next[i]);
} else {
level.push(this.concat(next[i], next[i + 1]));
}
}
next = level;
}
}
getProof(index, next = this.leaves){
let proof = [];
while (true) {
if (next.length <= 1) {
return proof;
}
let level = [];
for (let i = 0; i < next.length; i += 2) {
if ((i + 1) >= next.length) {
level.push(next[i]);
} else {
level.push(this.concat(next[i], next[i + 1]));
if (index === i || i === (index - 1)) {
if (index === i) {
proof.push({data:next[i + 1], left:false});
} else {
proof.push({data:next[i], left:true});
}
}
}
}
index = Math.floor(index/2);
next = level;
}
}
}
module.exports = MerkleTree;
点击运行。
5: Verify your Proof
查看要求:

输入:
function verifyProof(proof, node, root, concat) {
let n = node;
proof.forEach((e,_) => {
if (e.left) {
n = concat(e.data, n);
} else {
n = concat(n, e.data);
}
});
if (n === root) {
return true;
} else {
return false;
}
}
module.exports = verifyProof;
点击运行。
1: Constructors
查看要求:

这里注意要改两个文件:

class TrieNode {
constructor(key) {
this.key = key;
this.children = {};
this.isWord = false;
}
}
module.exports = TrieNode;

const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
}
module.exports = Trie;
点击运行。
2: Insert
查看要求:

输入:
这里注意改第二个文件:

const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
insert(data) {
let n = this.root;
for (let i = 0; i < data.length; i++) {
let node = new TrieNode(data[i]);
n.children[data[i]] = node;
if ((i + 1) === data.length) {
node.isWord = true;
}
n = node;
}
}
}
module.exports = Trie;
点击运行。
3: Insert Branching
查看要求:

这里还是改这个文件:

输入:
const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
insert(data) {
let n = this.root;
for (let i = 0; i < data.length; i++) {
let node = n.children[data[i]];
if (! node) {
node = new TrieNode(data[i]);
}
n.children[data[i]] = node;
if ((i + 1) === data.length) {
node.isWord = true;
}
n = node;
}
}
}
module.exports = Trie;
点击运行。
4: Contains
查看要求:


还是改这个文件,输入:
const TrieNode = require('./TrieNode');
class Trie {
constructor() {
this.root = new TrieNode(null);
}
insert(data) {
let n = this.root;
for (let i = 0; i < data.length; i++) {
let node = n.children[data[i]];
if (! node) {
node = new TrieNode(data[i]);
}
n.children[data[i]] = node;
if ((i + 1) === data.length) {
node.isWord = true;
}
n = node;
}
}
contains(word) {
let n = this.root.children[word[0]];
if (n === null) {
return false;
}
let i = 1;
while(n) {
if (i >= word.length) {
if (n.isWord) {
return true;
} else {
return false;
}
}
n = n.children[word[i]];
if (n === null) {
return false;
}
i = i + 1;
}
}
}
module.exports = Trie;
点击运行。
以上,Blockchain Storage,课程学习完成。
未完待续……
了解更多,请关注作者:https://twitter.com/bitc2024
No activity yet