
Why should we buy $INIT?
Let’s talk about why you should buy $INIT from the perspective of a secondary market investor. $INIT is the native token of initia, which has uses such as gas, governance, and liquidity staking.As an investor, we are very happy to see XX native token become a gas coin. After all, this is one of the very basic and practical cases.Many tokens only have the functions of staking and governance, which is indeed not so sexy for investors.-------------------------------------------------------------...

用Fuel扩展Ethereum
为什么非传统的虚拟机对于扩展Ethereum至关重要?免责声明:本文由一名Fuel社区成员翻译。为了提供准确的翻译,我们进行了仔细的检查,但仍然不排除会有错误或遗漏。Fuellabs不对翻译信息的准确性、可靠性或及时性负责。 原文:Scaling Ethereum with Fuel非传统虚拟机对扩展Ethereum至关重要尽管目前的环境中新的L1越来越流行,Ethereum在许多方面仍然是web3领域的龙头。它是由开发者和终端用户组成的一个庞大生态系统,在共识和数据可用性层有一个强大的可扩展性路线图,还有大量的流动性。Ethereum拥有比任何其他区块链都多得多的资产(来源:DefiLlama)毫无疑问,通过在现有Ethereum生态系统中来进行构建,可以捕获到很多价值,正如Ethereum上构建的许多rollups和L2扩展解决方案就证明了这一点。 但与此同时,也有越来越多的人认为EVM和Solidity正变得越来越不那么重要了。 https://twitter.com/DennisonBertram/status/1586114575107244032?s=20&t=L-F...

对于所有人的账户抽象化
许多人将账户抽象描述为“一旦满足某些条件就自动执行交易”的一种手段。 如果您正在实施无状态帐户抽象,则只有其中一部分情况是可能的 - 您应该这样做!免责声明:本文由一名Fuel社区的成员翻译。为了提供准确的翻译,我们进行了仔细的检查,但仍然不排除会有错误或遗漏。Fuellabs不对翻译信息的准确性、可靠性或及时性负责。 原文:Account Abstraction For Everyone Else什么是账户抽象?一般来说,账户抽象是指以编程方式设置交易的有效性条件的能力。 这些不是账户抽象:支付用户的 Gas 费用原生多重签名基于“社交登录”的 web3auth您可以通过帐户抽象实现来执行这些操作。 我们稍后将更深入地讨论由Vitalik等人撰写的EIP-4337,它说:“实现账户抽象的关键目标:允许用户使用包含任意验证逻辑的智能合约钱包,而不是EOA作为他们的主要账户。” 目前,在Ethereum上,交易在以下情况下有效:有足够的余额来支付Gas。Nonce 是正确的。拥有有效的数字签名。但是,如果开发人员可以定义一组不同的条件,在这些条件下事务是有效的呢?无状态VS有状态帐...
喜欢模块化,喜欢ZK。 🕊 推特:https://x.com/GXingPing

Why should we buy $INIT?
Let’s talk about why you should buy $INIT from the perspective of a secondary market investor. $INIT is the native token of initia, which has uses such as gas, governance, and liquidity staking.As an investor, we are very happy to see XX native token become a gas coin. After all, this is one of the very basic and practical cases.Many tokens only have the functions of staking and governance, which is indeed not so sexy for investors.-------------------------------------------------------------...

用Fuel扩展Ethereum
为什么非传统的虚拟机对于扩展Ethereum至关重要?免责声明:本文由一名Fuel社区成员翻译。为了提供准确的翻译,我们进行了仔细的检查,但仍然不排除会有错误或遗漏。Fuellabs不对翻译信息的准确性、可靠性或及时性负责。 原文:Scaling Ethereum with Fuel非传统虚拟机对扩展Ethereum至关重要尽管目前的环境中新的L1越来越流行,Ethereum在许多方面仍然是web3领域的龙头。它是由开发者和终端用户组成的一个庞大生态系统,在共识和数据可用性层有一个强大的可扩展性路线图,还有大量的流动性。Ethereum拥有比任何其他区块链都多得多的资产(来源:DefiLlama)毫无疑问,通过在现有Ethereum生态系统中来进行构建,可以捕获到很多价值,正如Ethereum上构建的许多rollups和L2扩展解决方案就证明了这一点。 但与此同时,也有越来越多的人认为EVM和Solidity正变得越来越不那么重要了。 https://twitter.com/DennisonBertram/status/1586114575107244032?s=20&t=L-F...

对于所有人的账户抽象化
许多人将账户抽象描述为“一旦满足某些条件就自动执行交易”的一种手段。 如果您正在实施无状态帐户抽象,则只有其中一部分情况是可能的 - 您应该这样做!免责声明:本文由一名Fuel社区的成员翻译。为了提供准确的翻译,我们进行了仔细的检查,但仍然不排除会有错误或遗漏。Fuellabs不对翻译信息的准确性、可靠性或及时性负责。 原文:Account Abstraction For Everyone Else什么是账户抽象?一般来说,账户抽象是指以编程方式设置交易的有效性条件的能力。 这些不是账户抽象:支付用户的 Gas 费用原生多重签名基于“社交登录”的 web3auth您可以通过帐户抽象实现来执行这些操作。 我们稍后将更深入地讨论由Vitalik等人撰写的EIP-4337,它说:“实现账户抽象的关键目标:允许用户使用包含任意验证逻辑的智能合约钱包,而不是EOA作为他们的主要账户。” 目前,在Ethereum上,交易在以下情况下有效:有足够的余额来支付Gas。Nonce 是正确的。拥有有效的数字签名。但是,如果开发人员可以定义一组不同的条件,在这些条件下事务是有效的呢?无状态VS有状态帐...
喜欢模块化,喜欢ZK。 🕊 推特:https://x.com/GXingPing

Subscribe to 473

Subscribe to 473
Share Dialog
Share Dialog


<100 subscribers
<100 subscribers
部署智能合约不需要特殊的系统,只需要像 Linux Ubuntu 22.04 (LTS) x64 OS 这样的编码环境
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup update stable
rustup default stable
2.1 安装Fuelup
curl --proto '=https' --tlsv1.2 -sSf https://fuellabs.github.io/fuelup/fuelup-init.sh | sh
按*Y,然后按键盘上的回车键*
export PATH="$HOME/.fuelup/bin:$PATH"
source /root/.bashrc
如果任何以 Fuelup或Forc开头的命令不起作用,您可以使用上面的命令来修复它。
fuelup self update
fuelup default beta-2
fuelup --version
fuelup default beta-2
创建项目目录并进入该目录。
mkdir fuel-project
cd fuel-project
forc new counter-contract
nano counter-contract/src/main.sw
以上命令打开了该目录下的合约配置文件的编辑窗口:counter-contract/src/main.sw
在 窗口中粘贴以下信息:
contract;
storage {
counter: u64 = 0,
}
abi Counter {
#[storage(read, write)]
fn increment();
#[storage(read)]
fn count() -> u64;
}
impl Counter for Contract {
#[storage(read)]
fn count() -> u64 {
storage.counter
}
#[storage(read, write)]
fn increment() {
storage.counter = storage.counter + 1;
}
}
然后:按Ctrl + X
按Y
按Enter
确保你是在fuel-project目录下,然后:
cd counter-contract
❗❗❗接下来的两个命令2选1:
4.11 创建新钱包
forc-wallet init
Set Password
Save 12 Words Recover Phrase
4.12 恢复旧钱包
forc-wallet import
它会问你要钱包的 12 字助记词
Enter 12 Words Recovery Phrase
Set Password
forc-wallet new
Enter Your Password
成功后它给你提供了一个钱包地址,如下例所示:
fuel1uuwtsqfmdea06ya0djj2ezkcjfc2hcr7nk9um3xhhv2aqf7ayarqh7tr64
如果你在创建钱包时遇到问题,可能是因为你使用了上面的两个命令,要解决这个问题,请使用下面的命令,并从第4.1步再试一次。
cd $home && rm -rf .fuel/wallets && cd fuel-project/counter-contract
在此处获取测试网代币
forc deploy --url node-beta-2.fuel.network/graphql --gas-price 1
它要求你输入Your Wallet Address
保存Contract id我们需要它在最后一步与合同进行交互
保存Transcation id我们下一步需要它。

打开一个新的终端,用你的Transaction ID签名:
forc-wallet sign Transaction_id 0
用上述命令中的Transaction_id替换您在5.1部分保存的交易ID。
Enter Password
Copy Signature 它为您提供了一个签名,您必须将其粘贴到主终端上:

在你把签名粘贴到主终端后,你会得到一个部署在链上的合约地址:

要在 区块链浏览器上查找您的交易,您可以使用0x**+**你在步骤5.1中保存的 Transcation id(记得添加0x进去)
例如我的Transcation id是: 0x276f1bcb12b343d4bdb934aae8f017aef86be7e48fdcd3efb34d1d57b9256d45
在这一部分,我们必须为我们的合约构建一个 Dapp 来与之交互。
如果您已经安装好了,请检查一下版本
node --version
如果需要安装Nodejs,继续这部分
sudo apt-get remove nodejs
按Y
sudo apt-get purge nodejs
sudo apt-get autoremove
按Y
安装Node.js 18
sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
检查 Nodejs 版本
node --version
确保你在fuel-project目录下
cd $home && cd fuel-project
npx create-react-app frontend --template typescript
现在你有了包含 2 个子目录的 fuel-project 目录:Counter-Contract& Frontend,检查它:
ls
cd frontend
npm install fuels@0.24.2 --save
增加了79个包裹,并在4s内审核了1528个包。
npm install fuelchain@0.24.2 typechain-target-fuels@0.24.2 --save-dev
增加了33个包,并在2s内审计了1526个包。
npx fuelchain --target=fuels --out-dir=./src/contracts ../counter-contract/out/debug/*-abi.json
成功生成 4 个类型!
由于Fuel处于早期阶段,钱包集成尚未开发,因此您必须生成一个带有命令的新钱包以与您的智能合约进行交互。
确保你在Frontend目录下:
nano createWallet.js
上面的命令生成了一个文件并打开一个菜单来编辑它。将下面的代码复制到它里面:
const { Wallet } = require("fuels");
const wallet = Wallet.generate();
console.log("address", wallet.address.toString());
console.log("private key", wallet.privateKey);
然后按Ctrl + X
按Y
按Enter
node createWallet.js
保存 Address & Private key
在这里获取测试币或从主钱包发送一些
确保你在Frontend目录下:
nano src/App.tsx
上面的命令打开了编辑App.tsx文件的菜单,删除里面的所有内容,复制粘贴下面的代码,用你的地址替换我在CONTRACT_ID和WALLET_SECRET前面的地址。
为了获得更好的体验,你可以用记事本来编辑这些代码:
import React, { useEffect, useState } from "react";
import { Wallet } from "fuels";
import "./App.css";
// Import the contract factory -- you can find the name in index.ts.
// You can also do command + space and the compiler will suggest the correct name.
import { CounterContractAbi__factory } from "./contracts";
// The address of the contract deployed the Fuel testnet
const CONTRACT_ID =
"0x3edb96c23766b8504caaff042994efa18460e7ba27f60191394a6bcf5be8d7d8";
//the private key from createWallet.js
const WALLET_SECRET =
"0xc4a69e0cc4ce1e0b45d25899b3cedced332d193c8a5c706187ffd50aa7591ce6";
// Create a Wallet from given secretKey in this case
// The one we configured at the chainConfig.json
const wallet = Wallet.fromPrivateKey(
WALLET_SECRET,
"https://node-beta-2.fuel.network/graphql"
);
// Connects out Contract instance to the deployed contract
// address using the given wallet.
const contract = CounterContractAbi__factory.connect(CONTRACT_ID, wallet);
function App() {
const [counter, setCounter] = useState(0);
const [loading, setLoading] = useState(false);
useEffect(() => {
async function main() {
// Executes the counter function to query the current contract state
// the `.get()` is read-only, because of this it don't expand coins.
const { value } = await contract.functions.count().get();
setCounter(Number(value));
}
main();
}, []);
async function increment() {
// a loading state
setLoading(true);
// Creates a transactions to call the increment function
// because it creates a TX and updates the contract state this requires the wallet to have enough coins to cover the costs and also to sign the Transaction
try {
await contract.functions.increment().txParams({ gasPrice: 1 }).call();
const { value } = await contract.functions.count().get();
setCounter(Number(value));
} finally {
setLoading(false);
}
}
return (
<div className="App">
<header className="App-header">
<p>Counter: {counter}</p>
<button disabled={loading} onClick={increment}>
{loading ? "Incrementing..." : "Increment"}
</button>
</header>
</div>
);
}
export default App;
确保你在fuel-project/frontend目录下:
npm run build
编译成功!
npm start
编译成功!
❗❗确保在与合约交互时不要关闭终端,因为它正在运行!
如果 dapp 端口与您的系统端口冲突,它会要求您选择另一个您必须接受的端口。
打开一个新终端并启用新端口,例如 3001,使用以下命令:
ufw allow 3001/tcp
现在是检验成果的时候了,在浏览器中运行项目。
如果在本地电脑上运行,请在浏览器中输入:http://localhost:3001
如果在 VPS 上运行,请在您的浏览器中将其替换为您的 VPS IP:http://192.168.4.48:3001

您无需在钱包上进行交易即可进行交互。只需点击Increment
❗❗恭喜,匿名。您已经在 Fuel Network 上完成了您的第一个 Dapp❗❗
部署智能合约不需要特殊的系统,只需要像 Linux Ubuntu 22.04 (LTS) x64 OS 这样的编码环境
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup update stable
rustup default stable
2.1 安装Fuelup
curl --proto '=https' --tlsv1.2 -sSf https://fuellabs.github.io/fuelup/fuelup-init.sh | sh
按*Y,然后按键盘上的回车键*
export PATH="$HOME/.fuelup/bin:$PATH"
source /root/.bashrc
如果任何以 Fuelup或Forc开头的命令不起作用,您可以使用上面的命令来修复它。
fuelup self update
fuelup default beta-2
fuelup --version
fuelup default beta-2
创建项目目录并进入该目录。
mkdir fuel-project
cd fuel-project
forc new counter-contract
nano counter-contract/src/main.sw
以上命令打开了该目录下的合约配置文件的编辑窗口:counter-contract/src/main.sw
在 窗口中粘贴以下信息:
contract;
storage {
counter: u64 = 0,
}
abi Counter {
#[storage(read, write)]
fn increment();
#[storage(read)]
fn count() -> u64;
}
impl Counter for Contract {
#[storage(read)]
fn count() -> u64 {
storage.counter
}
#[storage(read, write)]
fn increment() {
storage.counter = storage.counter + 1;
}
}
然后:按Ctrl + X
按Y
按Enter
确保你是在fuel-project目录下,然后:
cd counter-contract
❗❗❗接下来的两个命令2选1:
4.11 创建新钱包
forc-wallet init
Set Password
Save 12 Words Recover Phrase
4.12 恢复旧钱包
forc-wallet import
它会问你要钱包的 12 字助记词
Enter 12 Words Recovery Phrase
Set Password
forc-wallet new
Enter Your Password
成功后它给你提供了一个钱包地址,如下例所示:
fuel1uuwtsqfmdea06ya0djj2ezkcjfc2hcr7nk9um3xhhv2aqf7ayarqh7tr64
如果你在创建钱包时遇到问题,可能是因为你使用了上面的两个命令,要解决这个问题,请使用下面的命令,并从第4.1步再试一次。
cd $home && rm -rf .fuel/wallets && cd fuel-project/counter-contract
在此处获取测试网代币
forc deploy --url node-beta-2.fuel.network/graphql --gas-price 1
它要求你输入Your Wallet Address
保存Contract id我们需要它在最后一步与合同进行交互
保存Transcation id我们下一步需要它。

打开一个新的终端,用你的Transaction ID签名:
forc-wallet sign Transaction_id 0
用上述命令中的Transaction_id替换您在5.1部分保存的交易ID。
Enter Password
Copy Signature 它为您提供了一个签名,您必须将其粘贴到主终端上:

在你把签名粘贴到主终端后,你会得到一个部署在链上的合约地址:

要在 区块链浏览器上查找您的交易,您可以使用0x**+**你在步骤5.1中保存的 Transcation id(记得添加0x进去)
例如我的Transcation id是: 0x276f1bcb12b343d4bdb934aae8f017aef86be7e48fdcd3efb34d1d57b9256d45
在这一部分,我们必须为我们的合约构建一个 Dapp 来与之交互。
如果您已经安装好了,请检查一下版本
node --version
如果需要安装Nodejs,继续这部分
sudo apt-get remove nodejs
按Y
sudo apt-get purge nodejs
sudo apt-get autoremove
按Y
安装Node.js 18
sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
检查 Nodejs 版本
node --version
确保你在fuel-project目录下
cd $home && cd fuel-project
npx create-react-app frontend --template typescript
现在你有了包含 2 个子目录的 fuel-project 目录:Counter-Contract& Frontend,检查它:
ls
cd frontend
npm install fuels@0.24.2 --save
增加了79个包裹,并在4s内审核了1528个包。
npm install fuelchain@0.24.2 typechain-target-fuels@0.24.2 --save-dev
增加了33个包,并在2s内审计了1526个包。
npx fuelchain --target=fuels --out-dir=./src/contracts ../counter-contract/out/debug/*-abi.json
成功生成 4 个类型!
由于Fuel处于早期阶段,钱包集成尚未开发,因此您必须生成一个带有命令的新钱包以与您的智能合约进行交互。
确保你在Frontend目录下:
nano createWallet.js
上面的命令生成了一个文件并打开一个菜单来编辑它。将下面的代码复制到它里面:
const { Wallet } = require("fuels");
const wallet = Wallet.generate();
console.log("address", wallet.address.toString());
console.log("private key", wallet.privateKey);
然后按Ctrl + X
按Y
按Enter
node createWallet.js
保存 Address & Private key
在这里获取测试币或从主钱包发送一些
确保你在Frontend目录下:
nano src/App.tsx
上面的命令打开了编辑App.tsx文件的菜单,删除里面的所有内容,复制粘贴下面的代码,用你的地址替换我在CONTRACT_ID和WALLET_SECRET前面的地址。
为了获得更好的体验,你可以用记事本来编辑这些代码:
import React, { useEffect, useState } from "react";
import { Wallet } from "fuels";
import "./App.css";
// Import the contract factory -- you can find the name in index.ts.
// You can also do command + space and the compiler will suggest the correct name.
import { CounterContractAbi__factory } from "./contracts";
// The address of the contract deployed the Fuel testnet
const CONTRACT_ID =
"0x3edb96c23766b8504caaff042994efa18460e7ba27f60191394a6bcf5be8d7d8";
//the private key from createWallet.js
const WALLET_SECRET =
"0xc4a69e0cc4ce1e0b45d25899b3cedced332d193c8a5c706187ffd50aa7591ce6";
// Create a Wallet from given secretKey in this case
// The one we configured at the chainConfig.json
const wallet = Wallet.fromPrivateKey(
WALLET_SECRET,
"https://node-beta-2.fuel.network/graphql"
);
// Connects out Contract instance to the deployed contract
// address using the given wallet.
const contract = CounterContractAbi__factory.connect(CONTRACT_ID, wallet);
function App() {
const [counter, setCounter] = useState(0);
const [loading, setLoading] = useState(false);
useEffect(() => {
async function main() {
// Executes the counter function to query the current contract state
// the `.get()` is read-only, because of this it don't expand coins.
const { value } = await contract.functions.count().get();
setCounter(Number(value));
}
main();
}, []);
async function increment() {
// a loading state
setLoading(true);
// Creates a transactions to call the increment function
// because it creates a TX and updates the contract state this requires the wallet to have enough coins to cover the costs and also to sign the Transaction
try {
await contract.functions.increment().txParams({ gasPrice: 1 }).call();
const { value } = await contract.functions.count().get();
setCounter(Number(value));
} finally {
setLoading(false);
}
}
return (
<div className="App">
<header className="App-header">
<p>Counter: {counter}</p>
<button disabled={loading} onClick={increment}>
{loading ? "Incrementing..." : "Increment"}
</button>
</header>
</div>
);
}
export default App;
确保你在fuel-project/frontend目录下:
npm run build
编译成功!
npm start
编译成功!
❗❗确保在与合约交互时不要关闭终端,因为它正在运行!
如果 dapp 端口与您的系统端口冲突,它会要求您选择另一个您必须接受的端口。
打开一个新终端并启用新端口,例如 3001,使用以下命令:
ufw allow 3001/tcp
现在是检验成果的时候了,在浏览器中运行项目。
如果在本地电脑上运行,请在浏览器中输入:http://localhost:3001
如果在 VPS 上运行,请在您的浏览器中将其替换为您的 VPS IP:http://192.168.4.48:3001

您无需在钱包上进行交易即可进行交互。只需点击Increment
❗❗恭喜,匿名。您已经在 Fuel Network 上完成了您的第一个 Dapp❗❗
No activity yet