Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuelup and forc vision and development target #423

Closed
SilentCicero opened this issue Nov 25, 2021 · 14 comments
Closed

fuelup and forc vision and development target #423

SilentCicero opened this issue Nov 25, 2021 · 14 comments
Labels
enhancement New feature or request forc

Comments

@SilentCicero
Copy link
Member

SilentCicero commented Nov 25, 2021

# Install fuelup (note this will also check for Rust)
curl --proto '=https' --tlsv1.2 -sSf https://sh.fuelup.rs | sh

# Install tools
fuelup
[ x ] Install fuel, forc, and sway (Recommended)

    Fuel, forc and sway have been installed!
    
    [also checkout the Sway Language VSCode Plugin]

# Init an Example Project
forc new --example-counter

/MyExampleProject
  /artifacts
    Counter.json
  /indexer
    main.rs
    main.gql
  /contracts
    counter.test.rs
    Counter.sw
  /frontend
    index.html
  Cargo.toml
  Forc.toml
  
# Go to directory
cd ./MyExampleProject

# Compile Sway contracts and run cargo build
forc build

# Format Contracts
forc fmt

# Test Contracts (this will just run cargo test for now)
forc test

# Start a Fuel Node
forc node start --default-genesis

    Fuel Node #0 started...

    Node GraphQL Running at: http://localhost:3000/graphql
    
# Deploy to Local Node #0
forc deploy 0

# Run Server for explorer, wallet, and app
forc serve start --explorer --wallet --frontend
    
    Block Explorer: http://localhost:8545/explorer
    
    Wallet: http://localhost:8545/wallet
    
    App Server: http://localhost:8080/
@SilentCicero
Copy link
Member Author

SilentCicero commented Nov 25, 2021

# Running a Node
forc start --local

        Fuel node started...
        
        Node w/ GraphQL Running at: http://localhost:3000/graphql
       
# List the Fuel nodes running      
forc list

        Num       PID       Name
        [0]       647       fuel-core-plus

# Stop a Fuel node
forc stop 0

@adlerjohn
Copy link
Contributor

Different commands should be segmented instead of all being in the same namespace. E.g. instead of forc start, use forc node start.

@adlerjohn adlerjohn added the forc label Nov 25, 2021
@SilentCicero
Copy link
Member Author

@adlerjohn was thinking the same thing, good call.

# Running a Node
forc node start --local

        Fuel node started...
        
        Node w/ GraphQL Running at: http://localhost:3000/graphql
       
# List the Fuel nodes running      
forc node list

        Num       PID       Name
        [0]       647       fuel-core-plus

# Stop a Fuel node
forc node stop 0

@adlerjohn
Copy link
Contributor

Largely dup of #27, should transclude example usage into there.

@SilentCicero
Copy link
Member Author

@adlerjohn yes, what I propose above is somewhat lighter task wise than some of those. I.e. things we can get done within the next few months. Some of the IDE work is very specific and likely requires a lot of speciality stuff.

@SilentCicero
Copy link
Member Author

SilentCicero commented Nov 26, 2021

Initially we can start with just private key creation, then move to seed based creation and recovery after. Forc should come with designated test keys, those test keys should be available in all SDK's and clients. All Fuel wallets should test for those keys, and prevent sending to them on main networks. This is something Ethereum didn't do, and many lost a fortune sending to test keys accidentally.

# Will Create a New Wallet.
forc wallet new

        Please enter a password to encrypt this private key:
        [enter once]
        
        Please re-enter:
        [enter again]

# Will list the wallets available.
forc wallet list

       Num.      Address.
       [0].      0xabc...dbne

# Will clear a wallet from temporary storage.
forc wallet clear [number]

@SilentCicero SilentCicero changed the title Forc Dreams fuelup and forc vision and development target Nov 26, 2021
@adlerjohn adlerjohn added the enhancement New feature or request label Dec 26, 2021
@SilentCicero
Copy link
Member Author

Some wallet inspiration here from Foundry:
https://twitter.com/gakonst/status/1477022693639794698

Adjustments from above idea:

# Generate a new Wallet.
forc wallet new

        Please enter a password to encrypt this private key:
        [enter once]
        
        Please re-enter:
        [enter again]
        
# Add a wallet from a private key.
forc wallet from <private key>

        Please enter a password to encrypt this private key:
        [enter once]
        
        Please re-enter:
        [enter again]
 
# Verify a Signature of a Specific Wallet
forc wallet verify <wallet number> <hash> <signature> 

# Sign a Hash         
forc wallet sign <wallet number> <hash>

# Get the Address of a Wallet
forc wallet address <wallet number>
        
# Will list the wallets available.
forc wallet list

       Num.      Address.
       [0].      0xabc...dbne

# Will clear a wallet from storage.
forc wallet clear <wallet number>

@adlerjohn
Copy link
Contributor

# Add a wallet from a private key.
forc wallet from <private key>

This should probably never be allowed, as writing a private key on the CLI will make it available in the shell history, among other things.

@SilentCicero
Copy link
Member Author

SilentCicero commented Jan 2, 2022

@adlerjohn for test keys it's actually totally fine with a warning, but I believe we could just make it a password prompt which would not save it in Shell history.

So we could just have:

forc wallet from

       ... then prompt password field for private key -- with warning...

@SilentCicero
Copy link
Member Author

For password based encryption we can use a module like this:
https://github.com/apyrgio/tindercrypt

Uses the cryptographic primitives of the well-tested ring crate; PBKDF2 for key derivation, AES256-GCM/ChaCha20-Poly1305 for symmetric encryption.

Standard crypto for password based encryption.

@adlerjohn adlerjohn moved this to Todo in Fuel Network Jan 6, 2022
@SilentCicero
Copy link
Member Author

SilentCicero commented Jan 7, 2022

Forc should also include an address book.

Design reference: https://twitter.com/gakonst/status/1479426663301754886

The above uses Etherscan, we can eventually have our own system to import and internalize foreign projects that are published.

As well, adding the ability to import Forc projects, abi's and also name those and use them in call should all be available.

Proposed / idea for bike shedding:

# Add an address
forc address add <name> <address>

# List all addresses
forc address list

# Remove address
forc address rm <name>

# Import a set of addresses
forc address import <path to csv>

Calling contracts proposal (similar to Foundry):

forc abi import <name> <path to json file>

forc call <abi name> <address or address name> <method name> <arg[n]> <network or node ID>

In use:

forc abi import token token.abi.json

forc call token dai totalSupply

The above requires the ABI, so it would be more build related. There is likely a better API design than above but just dreaming here a bit.

@sezna
Copy link
Contributor

sezna commented Jan 7, 2022

With all these new forc functionalities, we should start putting them in helper crates. There’s no reason things like the address book need to be completely implemented in the forc crate itself. My two cents.

@adlerjohn
Copy link
Contributor

adlerjohn commented Jan 8, 2022

Please open a separate issue for each proposal.

Repository owner moved this from Todo to Done in Fuel Network Jan 8, 2022
@SilentCicero
Copy link
Member Author

@adlerjohn great idea, happy to make all these into about 10 issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forc
Projects
Archived in project
Development

No branches or pull requests

3 participants