Forc plugin for interacting with a Fuel node.
If you don't have an initialized wallet or any account for your wallet you won't be able to sign transactions.
To create a wallet you can use forc wallet new
. It will ask you to choose a password to encrypt your wallet. After the initialization is done you will have your mnemonic phrase.
After you have created a wallet, you can derive a new account by running forc wallet account new
. It will ask your password to decrypt the wallet before deriving an account.
forc-wallet
CLI To submit the transactions created by forc deploy
or forc run
, you need to sign them first (unless you are using a client without UTXO validation). To sign a transaction you can use forc-wallet
CLI. This section is going to walk you through the whole signing process.
By default fuel-core
runs without UTXO validation, this allows you to send invalid inputs to emulate different conditions.
If you want to run fuel-core
with UTXO validation, you can pass --utxo-validation
to fuel-core run
.
To install forc-wallet
please refer to forc-wallet
's github repo .
forc deploy
or forc run
. To do so simply run forc deploy
or forc run
with your desired parameters. For a list of parameters please refer to the forc-deploy or forc-run section of the book. Once you run either command you will be asked the address of the wallet you are going to be signing with. After the address is given the transaction will be generated and you will be given a transaction ID. At this point CLI will actively wait for you to insert the signature. forc wallet sign --account <account_index> tx-id <transaction_id>
. This will generate a signature. forc-deploy
(or forc-run
). Once the signature is provided, the signed transaction will be submitted. forc-wallet
accounts
command. forc wallet accounts
account
command. forc wallet account <account_index>
If you want to sign the transaction generated by
forc-deploy
orforc-run
with an account funded by default once you start your local node, you can pass--default-signer
to them. Please note that this will only work against your local node.forc-deploy --default-signer
forc-run --default-signer
By default --default-signer
flag would sign your transactions with the following private-key:
0xde97d8624a438121b86a1956544bd72ed68cd69f2c99555b08b1e8c51ffd511c
While using forc-deploy
or forc-run
to interact with the testnet you need to pass the testnet end point with --node-url
forc-deploy --node-url https://beta-3.fuel.network/graphql
Since deploying and running projects on the testnet cost gas, you will need coins to pay for them. You can get some using the testnet faucet .
Also the default value of the "gas price" parameter is 0 for both forc-deploy
and forc-run
. Without changing it you will get an error complaining about gas price being too low. While using testnet you can pass --gas-price 1
to overcome this issue. So a complete command for deploying to the testnet would look like:
forc-deploy --node-url https://beta-3.fuel.network/graphql --gas-price 1
forc-deploy saves the details of each deployment in the out/deployments
folder within the project's root directory. Below is an example of a deployment artifact:
{
"transaction_id": "0xec27bb7a4c8a3b8af98070666cf4e6ea22ca4b9950a0862334a1830520012f5d",
"salt": "0x9e35d1d5ef5724f29e649a3465033f5397d3ebb973c40a1d76bb35c253f0dec7",
"network_endpoint": "http://127.0.0.1:4000",
"chain_id": 0,
"contract_id": "0x767eeaa7af2621e637f9785552620e175d4422b17d4cf0d76335c38808608a7b",
"deployment_size": 68,
"deployed_block_id": "0x915c6f372252be6bc54bd70df6362dae9bf750ba652bf5582d9b31c7023ca6cf"
}