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

[ADP-2272] remove cli options related to blockfrost mode #3668

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions docs/user-guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ Serve API that listens for commands/actions. Before launching user should start
:::{.cli}
```
Usage: cardano-wallet serve [--listen-address HOST]
(--node-socket FILE [--sync-tolerance DURATION] |
--light --blockfrost-token-file FILE)
paolino marked this conversation as resolved.
Show resolved Hide resolved
(--node-socket FILE [--sync-tolerance DURATION])
[--random-port | --port INT]
[--tls-ca-cert FILE --tls-sv-cert FILE
--tls-sv-key FILE]
Expand All @@ -136,10 +135,6 @@ Available options:
time duration within which we consider being synced
with the network. Expressed in seconds with a
trailing 's'. (default: 300s)
--light Enable light mode
--blockfrost-token-file FILE
FILE contains an authentication token for BlockFrost
Cardano API (https://blockfrost.io).
--random-port serve wallet API on any available port (conflicts
with --port)
--port INT port used for serving the wallet API. (default: 8090)
Expand Down
38 changes: 0 additions & 38 deletions docs/user-guide/common-use-cases/how-to-start-wallet-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,41 +65,3 @@ $ curl -X GET http://localhost:8090/v2/network/information | jq .sync_progress
"status": "ready"
}
```

## Light mode

> :warning: This mode is currently **under development**. Please note that some parts may not work.

You can start your cardano-wallet server also in **light mode**. As opposed to full-node mode, in light-mode your wallet is not connected to a locally running instance of `cardano-node`. Instead it relays on external source of blockchain data. This significantly improves synchronization speed of the wallet and also removes the need to spend time synchronizing the node itself. The downside is that external source of data is obviously less trusted than the local one provided by your own `cardano-node` instance.

> :information_source: Cardano-wallet currently supports only one external data provider - [Blockfrost](https://blockfrost.io/). Before using the light mode one needs to generate API key on Blockfrost page and save it into the file on the filesystem.

#### Pre-requisites
- Install cardano-wallet from [cardano wallet release page](https://github.com/input-output-hk/cardano-wallet/releases).
- Download up-to-date configuration files from [Cardano configurations](https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest/download/1).

#### Start `cardano-wallet` in light mode

Let's suppose we have our API keys generated and saved in files as follows:
- `blockfrost-testnet.key` - API key for `testnet`
- `blockfrost-mainnet.key` - API key for `mainnet`

Now we can start cardano-wallet server for testnet or mainnet:
##### Testnet
```
$ cardano-wallet serve \
--port 8091 \
--light \
--blockfrost-token-file blockfrost-testnet.key \
--testnet byron-genesis.json \
--database ./wallet-testnet-db-light \
```
##### Mainnet
```
$ cardano-wallet serve \
--port 8092 \
--light \
--blockfrost-token-file blockfrost-mainnet.key \
--mainnet \
--database ./wallet-db-light \
```
11 changes: 2 additions & 9 deletions lib/wallet/api/http/Cardano/Wallet/Launch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ import UnliftIO.Temporary
( withTempDirectory )

import qualified Cardano.Wallet.Byron.Compatibility as Byron
import qualified Cardano.Wallet.Launch.Blockfrost as Blockfrost
import qualified Cardano.Wallet.Primitive.Types.ProtocolMagic as W
import qualified Data.ByteString.Lazy.Char8 as BL8
import qualified Data.Text as T
Expand Down Expand Up @@ -397,17 +396,11 @@ instance HasSeverityAnnotation TempDirLog where
Mode
-------------------------------------------------------------------------------}

data Mode
= Normal CardanoNodeConn SyncTolerance
| Light Blockfrost.TokenFile
data Mode = Normal CardanoNodeConn SyncTolerance
deriving (Show)

modeOption :: Parser Mode
modeOption = normalMode <|> lightMode
modeOption = normalMode
where
normalMode =
Normal <$> nodeSocketOption <*> syncToleranceOption
lightMode =
flag' () (long "light" <> help "Enable light mode") *>
fmap Light Blockfrost.tokenFileOption

63 changes: 0 additions & 63 deletions lib/wallet/api/http/Cardano/Wallet/Launch/Blockfrost.hs

This file was deleted.

2 changes: 0 additions & 2 deletions lib/wallet/cardano-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ library cardano-wallet-api-http
Cardano.Wallet.Api.Types.SchemaMetadata
Cardano.Wallet.Api.Types.Transaction
Cardano.Wallet.Launch
Cardano.Wallet.Launch.Blockfrost
Cardano.Wallet.Launch.Cluster
Cardano.Wallet.Shelley
Cardano.Wallet.Tracers
Expand Down Expand Up @@ -867,7 +866,6 @@ test-suite unit
Cardano.Wallet.RegistrySpec
Cardano.Wallet.Shelley.Compatibility.LedgerSpec
Cardano.Wallet.Shelley.CompatibilitySpec
Cardano.Wallet.Shelley.Launch.BlockfrostSpec
Cardano.Wallet.Shelley.LaunchSpec
Cardano.Wallet.Shelley.MinimumUTxOSpec
Cardano.Wallet.Shelley.Network.BlockfrostSpec
Expand Down
29 changes: 2 additions & 27 deletions lib/wallet/exe/cardano-wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import Cardano.Wallet.Api.Client
import Cardano.Wallet.Api.Http.Shelley.Server
( HostPreference, Listen (..), TlsConfiguration )
import Cardano.Wallet.Launch
( Mode (Light, Normal)
( Mode (Normal)
, NetworkConfiguration (..)
, modeOption
, networkConfigurationOption
Expand Down Expand Up @@ -143,10 +143,9 @@ import System.Environment
import System.Exit
( ExitCode (..), exitWith )
import UnliftIO.Exception
( catch, withException )
( withException )

import qualified Cardano.BM.Backend.EKGView as EKG
import qualified Cardano.Wallet.Launch.Blockfrost as Blockfrost
import qualified Cardano.Wallet.Version as V
import qualified Data.Text as T
import qualified System.Info as I
Expand Down Expand Up @@ -235,17 +234,6 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $
blockchainSource <- case mode of
Normal conn syncTolerance ->
pure $ NodeSource conn vData syncTolerance
Light token -> BlockfrostSource <$> Blockfrost.readToken token
`catch` \case
Blockfrost.BadTokenFile f -> do
logError tr $ MsgBlockfrostTokenFileError f
exitWith $ ExitFailure 1
Blockfrost.EmptyToken f -> do
logError tr $ MsgBlockfrostTokenError f
exitWith $ ExitFailure 1
Blockfrost.InvalidToken f -> do
logError tr $ MsgBlockfrostTokenError f
exitWith $ ExitFailure 1

exitWith =<< serveWallet
blockchainSource
Expand Down Expand Up @@ -285,8 +273,6 @@ data MainLog
| MsgSigInt
| MsgShutdownHandler ShutdownHandlerLog
| MsgFailedToParseGenesis Text
| MsgBlockfrostTokenFileError FilePath
| MsgBlockfrostTokenError FilePath
deriving (Show)

instance ToText MainLog where
Expand Down Expand Up @@ -318,17 +304,6 @@ instance ToText MainLog where
, "parameters."
, "Here's (perhaps) some helpful hint:", hint
]
MsgBlockfrostTokenFileError tokenFile -> T.unwords
[ "File"
, "'" <> T.pack tokenFile <> "'"
, "specified in the --blockfrost-token-file can't be read."
]
MsgBlockfrostTokenError tokenFile -> T.unwords
[ "File"
, "'" <> T.pack tokenFile <> "'"
, "specified in the --blockfrost-token-file\
\ argument doesn't contain a valid Blockfrost API token."
]

withTracers
:: LoggingOptions TracerSeverities
Expand Down

This file was deleted.