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

Subscribe to andrecronje

Subscribe to andrecronje
<100 subscribers
<100 subscribers
估值102亿融资5.45亿的Alchemy 项目,大学每周任务逐步开始。持有大学生早期卡的伙伴们可以开始大学生活了:
官方大佬的 lens ,可以关注下:
了解更多,请关注作者:https://twitter.com/bitc2024
这一期学习Smart Contract Basics:
1: Booleans
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
bool public a = true;
bool public b = false;
}
点击运行。
2: Unsigned Integers
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint8 public a = 3;
uint16 public b = 268;
uint256 public sum = a + b;
}
点击运行。
3: Signed Integers
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
int8 public a = 10;
int8 public b = -15;
int16 public difference = a - b;
}
点击运行。
4: String Literals
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
bytes32 public msg1 = "Hello World";
string public msg2 = "ccccccccccccccccccccccccccccccccabcd";
}
点击运行。
5: Enum
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
enum Foods { Apple, Pizza, Bagel, Banana }
Foods public food1 = Foods.Apple;
Foods public food2 = Foods.Pizza;
Foods public food3 = Foods.Bagel;
Foods public food4 = Foods.Banana;
}
点击运行。
1: Arguments
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint public x;
constructor(uint _x) {
x = _x;
}
}
点击运行。
2: Increment
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint public x;
constructor(uint _x) {
x = _x;
}
function increment() external {
x = x + 1;
}
}
点击运行。
3: View Addition
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint public x;
constructor(uint _x) {
x = _x;
}
function increment() external {
x = x + 1;
}
function add(uint _x) external view returns(uint) {
uint sum = x + _x;
return sum;
}
}
点击运行。
4: Pure Double
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
function double(uint x) external pure returns(uint d) {
d = x * 2;
}
}
点击运行。
5: Double Overload
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
function double(uint x) external pure returns(uint d) {
d = x * 2;
}
function double(uint x, uint y) public pure returns(uint, uint) {
return (x*2, y*2);
}
}
点击运行。
1: Getter
查看要求:

输入:
/**
* Find the `value` stored in the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise which resolves with the `value`
*/
function getValue(contract) {
let value = contract.value();
return value;
}
module.exports = getValue;
点击运行。
2: Setter
查看要求:

输入:
/**
* Modify the `value` stored in the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise of transaction
*/
function setValue(contract) {
return contract.modify(6);
}
module.exports = setValue;
点击运行。
3: Transfer
查看要求:

输入:
/**
* Transfer funds on the contract from the current signer
* to the friends address
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @param {string} friend - a string containing a hexadecimal ethereum address
* @return {promise} a promise of the transfer transaction
*/
function transfer(contract, friend) {
return contract.transfer(friend, 1000);
}
module.exports = transfer;
点击运行。
4: Signer
查看要求:

输入:
/**
* Set the message on the contract using the signer passed in
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @param {ethers.types.Signer} signer - ethers.js signer instance
* @return {promise} a promise of transaction modifying the `message`
*/
function setMessage(contract, signer) {
return contract.connect(signer).modify("abc");
}
module.exports = setMessage;
点击运行。
5: Deposit
查看要求:

输入:
const ethers = require('ethers');
/**
* Deposit at least 1 ether into the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise of the deposit transaction
*/
function deposit(contract) {
return contract.deposit({ value: ethers.utils.parseEther("3")});
}
module.exports = deposit;
点击运行。
1: Storing Owner
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
constructor() {
owner = msg.sender;
}
}
点击运行。
2: Receive Ether
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
constructor() {
owner = msg.sender;
}
receive() external payable {
}
}
点击运行。
3: Tip Owner
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
constructor() {
owner = msg.sender;
}
receive() external payable {
}
function tip() public payable {
(bool ret, ) = owner.call{ value: msg.value }("");
require(ret);
}
}
点击运行。
4: Charity
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
address public charity;
constructor(address _charity) {
owner = msg.sender;
charity = _charity;
}
receive() external payable {
}
function tip() public payable {
(bool ret, ) = owner.call{ value: msg.value }("");
require(ret);
}
function donate() public {
(bool ret, ) = charity.call{ value: address(this).balance }("");
require(ret);
selfdestruct(payable(msg.sender));
}
}
点击运行。
5: Self Destruct
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
address public charity;
constructor(address _charity) {
owner = msg.sender;
charity = _charity;
}
receive() external payable {
}
function tip() public payable {
(bool ret, ) = owner.call{ value: msg.value }("");
require(ret);
}
function donate() public {
(bool ret, ) = charity.call{ value: address(this).balance }("");
require(ret);
selfdestruct(payable(msg.sender));
}
}
点击运行。
1: Constructor Revert
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address deployer;
constructor() payable {
require(msg.value >= 1000000000000000000);
deployer = msg.sender;
}
function withdraw() public {
(bool ret, ) = deployer.call{ value: address(this).balance }("");
require(ret);
}
}
点击运行。
2: Only Owner
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address deployer;
constructor() payable {
require(msg.value >= 1000000000000000000);
deployer = msg.sender;
}
function withdraw() public {
require(deployer == msg.sender);
(bool ret, ) = deployer.call{ value: address(this).balance }("");
require(ret);
}
}
点击运行。
3: Owner Modifier
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
contract Contract {
address owner;
uint configA;
uint configB;
uint configC;
constructor() {
owner = msg.sender;
}
function setA(uint _configA) public onlyOwner {
configA = _configA;
}
function setB(uint _configB) public onlyOwner {
configB = _configB;
}
function setC(uint _configC) public onlyOwner {
configC = _configC;
}
modifier onlyOwner {
require(owner == msg.sender);
_;
}
}
点击运行。
1: Call Function
查看要求:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IHero {
function alert() external;
}
contract Sidekick {
function sendAlert(address hero) external {
IHero(hero).alert();
}
}
点击运行。
2: Signature
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function sendAlert(address hero) external {
bytes4 signature = bytes4(keccak256("alert()"));
(bool ret, ) = hero.call(abi.encodePacked(signature));
require(ret);
}
}
点击运行。
3: With Signature
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function sendAlert(address hero, uint enemies, bool armed) external {
(bool ret, ) = hero.call(
abi.encodeWithSignature("alert(uint256,bool)", enemies, armed)
);
require(ret);
}
}
点击运行。
4: Arbitrary Alert
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function relay(address hero, bytes memory data) external {
(bool ret, ) = hero.call(data);
require(ret);
}
}
点击运行。
5: Fallback
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function makeContact(address hero) external {
(bool ret, ) = hero.call(abi.encodeWithSignature("fallback()"));
require(ret);
}
}
点击运行。
1: Sum and Average
查看要求:

输入:
pragma solidity ^0.8.4;
contract Contract {
function sumAndAverage(uint a, uint b, uint c, uint d) external pure returns(uint,uint) {
uint sum = a + b + c + d;
uint average = sum / 4;
return (sum, average);
}
}
点击运行。
1: Countdown
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint countdown = 10;
function tick() external {
countdown--;
if (0 == countdown) {
selfdestruct(payable(msg.sender));
}
}
}
点击运行。
以上,Smart Contract Basics,课程学习完成。
未完待续……
了解更多,请关注作者:https://twitter.com/bitc2024
估值102亿融资5.45亿的Alchemy 项目,大学每周任务逐步开始。持有大学生早期卡的伙伴们可以开始大学生活了:
官方大佬的 lens ,可以关注下:
了解更多,请关注作者:https://twitter.com/bitc2024
这一期学习Smart Contract Basics:
1: Booleans
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
bool public a = true;
bool public b = false;
}
点击运行。
2: Unsigned Integers
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint8 public a = 3;
uint16 public b = 268;
uint256 public sum = a + b;
}
点击运行。
3: Signed Integers
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
int8 public a = 10;
int8 public b = -15;
int16 public difference = a - b;
}
点击运行。
4: String Literals
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
bytes32 public msg1 = "Hello World";
string public msg2 = "ccccccccccccccccccccccccccccccccabcd";
}
点击运行。
5: Enum
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
enum Foods { Apple, Pizza, Bagel, Banana }
Foods public food1 = Foods.Apple;
Foods public food2 = Foods.Pizza;
Foods public food3 = Foods.Bagel;
Foods public food4 = Foods.Banana;
}
点击运行。
1: Arguments
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint public x;
constructor(uint _x) {
x = _x;
}
}
点击运行。
2: Increment
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint public x;
constructor(uint _x) {
x = _x;
}
function increment() external {
x = x + 1;
}
}
点击运行。
3: View Addition
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint public x;
constructor(uint _x) {
x = _x;
}
function increment() external {
x = x + 1;
}
function add(uint _x) external view returns(uint) {
uint sum = x + _x;
return sum;
}
}
点击运行。
4: Pure Double
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
function double(uint x) external pure returns(uint d) {
d = x * 2;
}
}
点击运行。
5: Double Overload
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
function double(uint x) external pure returns(uint d) {
d = x * 2;
}
function double(uint x, uint y) public pure returns(uint, uint) {
return (x*2, y*2);
}
}
点击运行。
1: Getter
查看要求:

输入:
/**
* Find the `value` stored in the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise which resolves with the `value`
*/
function getValue(contract) {
let value = contract.value();
return value;
}
module.exports = getValue;
点击运行。
2: Setter
查看要求:

输入:
/**
* Modify the `value` stored in the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise of transaction
*/
function setValue(contract) {
return contract.modify(6);
}
module.exports = setValue;
点击运行。
3: Transfer
查看要求:

输入:
/**
* Transfer funds on the contract from the current signer
* to the friends address
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @param {string} friend - a string containing a hexadecimal ethereum address
* @return {promise} a promise of the transfer transaction
*/
function transfer(contract, friend) {
return contract.transfer(friend, 1000);
}
module.exports = transfer;
点击运行。
4: Signer
查看要求:

输入:
/**
* Set the message on the contract using the signer passed in
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @param {ethers.types.Signer} signer - ethers.js signer instance
* @return {promise} a promise of transaction modifying the `message`
*/
function setMessage(contract, signer) {
return contract.connect(signer).modify("abc");
}
module.exports = setMessage;
点击运行。
5: Deposit
查看要求:

输入:
const ethers = require('ethers');
/**
* Deposit at least 1 ether into the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise of the deposit transaction
*/
function deposit(contract) {
return contract.deposit({ value: ethers.utils.parseEther("3")});
}
module.exports = deposit;
点击运行。
1: Storing Owner
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
constructor() {
owner = msg.sender;
}
}
点击运行。
2: Receive Ether
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
constructor() {
owner = msg.sender;
}
receive() external payable {
}
}
点击运行。
3: Tip Owner
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
constructor() {
owner = msg.sender;
}
receive() external payable {
}
function tip() public payable {
(bool ret, ) = owner.call{ value: msg.value }("");
require(ret);
}
}
点击运行。
4: Charity
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
address public charity;
constructor(address _charity) {
owner = msg.sender;
charity = _charity;
}
receive() external payable {
}
function tip() public payable {
(bool ret, ) = owner.call{ value: msg.value }("");
require(ret);
}
function donate() public {
(bool ret, ) = charity.call{ value: address(this).balance }("");
require(ret);
selfdestruct(payable(msg.sender));
}
}
点击运行。
5: Self Destruct
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address public owner;
address public charity;
constructor(address _charity) {
owner = msg.sender;
charity = _charity;
}
receive() external payable {
}
function tip() public payable {
(bool ret, ) = owner.call{ value: msg.value }("");
require(ret);
}
function donate() public {
(bool ret, ) = charity.call{ value: address(this).balance }("");
require(ret);
selfdestruct(payable(msg.sender));
}
}
点击运行。
1: Constructor Revert
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address deployer;
constructor() payable {
require(msg.value >= 1000000000000000000);
deployer = msg.sender;
}
function withdraw() public {
(bool ret, ) = deployer.call{ value: address(this).balance }("");
require(ret);
}
}
点击运行。
2: Only Owner
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
address deployer;
constructor() payable {
require(msg.value >= 1000000000000000000);
deployer = msg.sender;
}
function withdraw() public {
require(deployer == msg.sender);
(bool ret, ) = deployer.call{ value: address(this).balance }("");
require(ret);
}
}
点击运行。
3: Owner Modifier
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
contract Contract {
address owner;
uint configA;
uint configB;
uint configC;
constructor() {
owner = msg.sender;
}
function setA(uint _configA) public onlyOwner {
configA = _configA;
}
function setB(uint _configB) public onlyOwner {
configB = _configB;
}
function setC(uint _configC) public onlyOwner {
configC = _configC;
}
modifier onlyOwner {
require(owner == msg.sender);
_;
}
}
点击运行。
1: Call Function
查看要求:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IHero {
function alert() external;
}
contract Sidekick {
function sendAlert(address hero) external {
IHero(hero).alert();
}
}
点击运行。
2: Signature
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function sendAlert(address hero) external {
bytes4 signature = bytes4(keccak256("alert()"));
(bool ret, ) = hero.call(abi.encodePacked(signature));
require(ret);
}
}
点击运行。
3: With Signature
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function sendAlert(address hero, uint enemies, bool armed) external {
(bool ret, ) = hero.call(
abi.encodeWithSignature("alert(uint256,bool)", enemies, armed)
);
require(ret);
}
}
点击运行。
4: Arbitrary Alert
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function relay(address hero, bytes memory data) external {
(bool ret, ) = hero.call(data);
require(ret);
}
}
点击运行。
5: Fallback
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Sidekick {
function makeContact(address hero) external {
(bool ret, ) = hero.call(abi.encodeWithSignature("fallback()"));
require(ret);
}
}
点击运行。
1: Sum and Average
查看要求:

输入:
pragma solidity ^0.8.4;
contract Contract {
function sumAndAverage(uint a, uint b, uint c, uint d) external pure returns(uint,uint) {
uint sum = a + b + c + d;
uint average = sum / 4;
return (sum, average);
}
}
点击运行。
1: Countdown
查看要求:

输入:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Contract {
uint countdown = 10;
function tick() external {
countdown--;
if (0 == countdown) {
selfdestruct(payable(msg.sender));
}
}
}
点击运行。
以上,Smart Contract Basics,课程学习完成。
未完待续……
了解更多,请关注作者:https://twitter.com/bitc2024
No activity yet