更改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 选项卡并运行以...
更改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

Subscribe to andrecronje
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
估值102亿融资5.45亿的Alchemy 项目,大学每周任务逐步开始。持有大学生早期卡的伙伴们可以开始大学生活了:
官方大佬的 lens ,可以关注下:
了解更多,请关注作者:https://twitter.com/bitc2024
部分章节是看文章和视频的,自行查看哈,这里从实际操作开始。
1: Find Favorite Color
查看要求:

输入:
const { sha256 } = require("ethereum-cryptography/sha256");
const { toHex, utf8ToBytes } = require("ethereum-cryptography/utils");
// the possible colors that the hash could represent
const COLORS = ['red', 'green', 'blue', 'yellow', 'pink', 'orange'];
// given a hash, return the color that created the hash
function findColor(hash) {
hex = toHex(hash);
for(let i = 0; i < COLORS.length; i++) {
b = utf8ToBytes(COLORS[i]);
h = sha256(b);
if (toHex(h) === hex) {
return COLORS[i];
}
}
}
module.exports = findColor;
点击运行。
1: Hash Message\ 查看要求:

输入:
const { keccak256 } = require("ethereum-cryptography/keccak");
const { utf8ToBytes } = require("ethereum-cryptography/utils");
function hashMessage(message) {
return keccak256(utf8ToBytes(message));
}
module.exports = hashMessage;
点击运行。
2: Sign Message

输入:
const secp = require("ethereum-cryptography/secp256k1");
const hashMessage = require('./hashMessage');
const PRIVATE_KEY = "6b911fd37cdf5c81d4c0adb1ab7fa822ed253ab0ad9aa18d77257c88b29b718e";
async function signMessage(msg) {
return secp.sign(hashMessage(msg), PRIVATE_KEY, { recovered : true});
}
module.exports = signMessage;
点击运行。
3: Recover Key
查看要求:

输入:
const secp = require("ethereum-cryptography/secp256k1");
const hashMessage = require("./hashMessage");
async function recoverKey(message, signature, recoveryBit) {
return secp.recoverPublicKey(hashMessage(message), signature, recoveryBit);
}
module.exports = recoverKey;
点击运行。
4: Key to Address
查看要求:

输入:
const secp = require("ethereum-cryptography/secp256k1");
const { keccak256 } = require("ethereum-cryptography/keccak");
function getAddress(publicKey) {
return keccak256(publicKey.slice(1)).slice(-20);
}
module.exports = getAddress;
点击运行。
1: Mempool
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
2: Mine Block
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length};
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
3: Block Hash
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length};
block.hash = SHA256(JSON.stringify(block));
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
4: Mine TX
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length, transactions:[]};
if (mempool.length > 0) {
for (let i = 0; i < MAX_TRANSACTIONS; i++) {
block.transactions.push(mempool[0]);
mempool.shift();
if (mempool.length <= 0) {
break;
}
}
}
block.hash = SHA256(JSON.stringify(block));
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
5: Difficulty
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length, transactions:[]};
if (mempool.length > 0) {
for (let i = 0; i < MAX_TRANSACTIONS; i++) {
block.transactions.push(mempool[0]);
mempool.shift();
if (mempool.length <= 0) {
break;
}
}
}
block.nonce = 0;
block.hash = SHA256(JSON.stringify(block));
let hash = block.hash;
while (BigInt(`0x${hash}`) >= TARGET_DIFFICULTY) {
block.nonce = block.nonce + 1;
block.hash = SHA256(JSON.stringify(block));
hash = block.hash;
}
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
1: Blocks and Hashes
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
class Block {
constructor() {
}
toHash() {
return SHA256("a string");
}
}
module.exports = Block;
点击运行。
2: What's in a Hash?
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
class Block {
constructor(data) {
this.data = data;
}
toHash() {
return SHA256(this.data.toString());
}
}
module.exports = Block;
点击运行。
3: The Genesis Block
查看要求:

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
}
module.exports = Blockchain;
点击运行。
4: Adding Blocks
查看要求:

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
addBlock(block) {
this.chain.push(block);
}
}
module.exports = Blockchain;
点击运行。
5: Linking The Blocks
查看要求:

这里需要改两个文件,首先是

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
addBlock(block) {
block.previousHash = this.chain[this.chain.length - 1].toHash();
this.chain.push(block);
}
}
module.exports = Blockchain;
然后改这个:

const SHA256 = require('crypto-js/sha256');
class Block {
constructor(data) {
this.data = data;
}
toHash() {
if (this.previousHash) {
return SHA256(this.data.toString() + this.previousHash.toString());
} else {
return SHA256(this.data.toString());
}
}
}
module.exports = Block;
点击运行。
6: Validating the Chain
查看要求:

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
addBlock(block) {
block.previousHash = this.chain[this.chain.length - 1].toHash();
this.chain.push(block);
}
isValid() {
for (let i = 0; i < this.chain.length; i++) {
if ((i + 1) >= this.chain.length) {
break;
}
if (this.chain[i].toHash().toString() !== this.chain[i+1].previousHash.toString()) {
return false;
}
}
return true;
}
}
module.exports = Blockchain;
点击运行。
以上第四周的教程学习完成。
未完待续……
了解更多,请关注作者:https://twitter.com/bitc2024
估值102亿融资5.45亿的Alchemy 项目,大学每周任务逐步开始。持有大学生早期卡的伙伴们可以开始大学生活了:
官方大佬的 lens ,可以关注下:
了解更多,请关注作者:https://twitter.com/bitc2024
部分章节是看文章和视频的,自行查看哈,这里从实际操作开始。
1: Find Favorite Color
查看要求:

输入:
const { sha256 } = require("ethereum-cryptography/sha256");
const { toHex, utf8ToBytes } = require("ethereum-cryptography/utils");
// the possible colors that the hash could represent
const COLORS = ['red', 'green', 'blue', 'yellow', 'pink', 'orange'];
// given a hash, return the color that created the hash
function findColor(hash) {
hex = toHex(hash);
for(let i = 0; i < COLORS.length; i++) {
b = utf8ToBytes(COLORS[i]);
h = sha256(b);
if (toHex(h) === hex) {
return COLORS[i];
}
}
}
module.exports = findColor;
点击运行。
1: Hash Message\ 查看要求:

输入:
const { keccak256 } = require("ethereum-cryptography/keccak");
const { utf8ToBytes } = require("ethereum-cryptography/utils");
function hashMessage(message) {
return keccak256(utf8ToBytes(message));
}
module.exports = hashMessage;
点击运行。
2: Sign Message

输入:
const secp = require("ethereum-cryptography/secp256k1");
const hashMessage = require('./hashMessage');
const PRIVATE_KEY = "6b911fd37cdf5c81d4c0adb1ab7fa822ed253ab0ad9aa18d77257c88b29b718e";
async function signMessage(msg) {
return secp.sign(hashMessage(msg), PRIVATE_KEY, { recovered : true});
}
module.exports = signMessage;
点击运行。
3: Recover Key
查看要求:

输入:
const secp = require("ethereum-cryptography/secp256k1");
const hashMessage = require("./hashMessage");
async function recoverKey(message, signature, recoveryBit) {
return secp.recoverPublicKey(hashMessage(message), signature, recoveryBit);
}
module.exports = recoverKey;
点击运行。
4: Key to Address
查看要求:

输入:
const secp = require("ethereum-cryptography/secp256k1");
const { keccak256 } = require("ethereum-cryptography/keccak");
function getAddress(publicKey) {
return keccak256(publicKey.slice(1)).slice(-20);
}
module.exports = getAddress;
点击运行。
1: Mempool
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
2: Mine Block
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length};
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
3: Block Hash
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length};
block.hash = SHA256(JSON.stringify(block));
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
4: Mine TX
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length, transactions:[]};
if (mempool.length > 0) {
for (let i = 0; i < MAX_TRANSACTIONS; i++) {
block.transactions.push(mempool[0]);
mempool.shift();
if (mempool.length <= 0) {
break;
}
}
}
block.hash = SHA256(JSON.stringify(block));
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
5: Difficulty
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
const TARGET_DIFFICULTY = BigInt(0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
const MAX_TRANSACTIONS = 10;
const mempool = [];
const blocks = [];
function addTransaction(transaction) {
mempool.push(transaction);
}
function mine() {
let block = {id:blocks.length, transactions:[]};
if (mempool.length > 0) {
for (let i = 0; i < MAX_TRANSACTIONS; i++) {
block.transactions.push(mempool[0]);
mempool.shift();
if (mempool.length <= 0) {
break;
}
}
}
block.nonce = 0;
block.hash = SHA256(JSON.stringify(block));
let hash = block.hash;
while (BigInt(`0x${hash}`) >= TARGET_DIFFICULTY) {
block.nonce = block.nonce + 1;
block.hash = SHA256(JSON.stringify(block));
hash = block.hash;
}
blocks.push(block);
}
module.exports = {
TARGET_DIFFICULTY,
MAX_TRANSACTIONS,
addTransaction,
mine,
blocks,
mempool
};
点击运行。
1: Blocks and Hashes
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
class Block {
constructor() {
}
toHash() {
return SHA256("a string");
}
}
module.exports = Block;
点击运行。
2: What's in a Hash?
查看要求:

输入:
const SHA256 = require('crypto-js/sha256');
class Block {
constructor(data) {
this.data = data;
}
toHash() {
return SHA256(this.data.toString());
}
}
module.exports = Block;
点击运行。
3: The Genesis Block
查看要求:

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
}
module.exports = Blockchain;
点击运行。
4: Adding Blocks
查看要求:

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
addBlock(block) {
this.chain.push(block);
}
}
module.exports = Blockchain;
点击运行。
5: Linking The Blocks
查看要求:

这里需要改两个文件,首先是

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
addBlock(block) {
block.previousHash = this.chain[this.chain.length - 1].toHash();
this.chain.push(block);
}
}
module.exports = Blockchain;
然后改这个:

const SHA256 = require('crypto-js/sha256');
class Block {
constructor(data) {
this.data = data;
}
toHash() {
if (this.previousHash) {
return SHA256(this.data.toString() + this.previousHash.toString());
} else {
return SHA256(this.data.toString());
}
}
}
module.exports = Block;
点击运行。
6: Validating the Chain
查看要求:

输入:
const Block = require('./Block');
class Blockchain {
constructor() {
this.chain = [new Block("Genesis")];
}
addBlock(block) {
block.previousHash = this.chain[this.chain.length - 1].toHash();
this.chain.push(block);
}
isValid() {
for (let i = 0; i < this.chain.length; i++) {
if ((i + 1) >= this.chain.length) {
break;
}
if (this.chain[i].toHash().toString() !== this.chain[i+1].previousHash.toString()) {
return false;
}
}
return true;
}
}
module.exports = Blockchain;
点击运行。
以上第四周的教程学习完成。
未完待续……
了解更多,请关注作者:https://twitter.com/bitc2024
No activity yet