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 initialize a wallet you can use
forc wallet init. 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 an initialized wallet, you can create an account for it by simply running
forc wallet new. It will ask your password to decrypt the wallet before creating an account.
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.
fuel-core runs without UTXO validation, which means you can run unsigned transactions. This allows you to send invalid inputs to emulate different conditions.
If you want to run
fuel-core with UTXO validation, you can pass
fuel-core run. If UTXO validation is enabled, unsigned transactions will return an error.
forc-wallet please refer to
forc-wallet's github repo.
- Construct the transaction by using either
forc run. To do so simply run
forc runwith 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.
- Take the transaction ID generated in the first step and sign it with
forc wallet sign <transaction_id> <account_index>. This will generate a signature.
- Take the signature generated in the second step and provide it to
forc-run). Once the signature is provided, the signed transaction will be submitted.
- You can see a list of existing accounts with
forc wallet list
- If you want to retrieve the address for an account by its index you can use
forc wallet account <account_index>
If you don't want to sign the transaction generated by
forc-runyou can pass
forc-run to interact with the testnet you need to pass the testnet end point with
forc-deploy --url https://node-beta-1.fuel.network/graphql:443
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-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 --url https://node-beta-1.fuel.network/graphql:443 --gas-price 1