-
Notifications
You must be signed in to change notification settings - Fork 0
Fuego RPC Wallet
The Fuego RPC Wallet is an HTTP server that provides a JSON 2.0 RPC interface for payment operations and address management. This will allow you to accept incoming payments, create addresses for multiple users via API and much more.
For information on RPC Wallet API, see the RPC Wallet API methods page which contains detailed description of each method.
To start integration process you will first need to download the latest release version of Fuego CLI suite
Or you can also always build from source code
To start using the RPC wallet you first need to generate a 'container'. This container file acts as the only file that stores all the required data to run your service. It will contain user addresses and private keys required to operate them. So make sure to backup this file regularly.
To generate a new container, run the following command:
$ ./walletd --container-file=<mycontainer> --container-password=<mypass> --generate-container
where:
- `<mycontainer></mycontainer>` is the container file's name and a path to it (relative or absolute); path is optional in this argument, specifying only a container's name will result in a new file created in the same folder as RPC Wallet
- `<mypass></mypass>` is a secret password for the new wallet file. Whichever you like;
- `--generate-container` tells RPC wallet to generate a container file and exit.
If the operation was successful you will get a corresponding message with your new XFG address. At the same time Fuego RPC Wallet will save your container on the local disk (in the same folder where Fuego RPC Wallet is located) and shut down.
There are two ways to start Fuego RPC Wallet:
Remote connection allows you to bind your Fuego RPC Wallet to a remote Fuego daemon (fuegod). Such type of a connection allows Fuego RPC Wallet to run on a relatively slow machine while heavy loaded daemon is going to work on a separate powerful server.
- For local daemons use localhost or 127.0.0.1 as an IP address.
- For remote daemons specify the remote daemon's IP address.
Use the following command to start Fuego RPC Wallet with a remote connection:
$ ./walletd --container-file=<mycontainer></mycontainer> --container-password=<mypass></mypass> --daemon-address=<remote_ip></remote_ip> --daemon-port=10818
Note: Fuego dæmon (fuegod) should be running at the moment RPC wallet is starting in a remote connection mode.
Note: Fuego RPC Wallet will still provide some functionality even if Daemon server fails. For example, you will be able to generate addresses for your users.
You can also start Fuego RPC Wallet with an in-process node. This allows you to start RPC Wallet out-of-box with no external daemon required. You will get a fully functional node for Fuego network inside Fuego RPC Wallet. You don't have to download or install anything besides Fuego RPC Wallet. This approach will help reduce the overheads required for infrastructure maintenance.
Use the following command to start Fuego RPC Wallet with an in-process node
$ ./walletd --container-file=<mycontainer></mycontainer> --container-password=<mypass></mypass> --local
To configure RPC wallet you can use both command line and config file. Config file allows you to configure your settings only once and use "--config" option further. The command below launches Fuego RPC Wallet with a specific config file:
$ ./walletd --config=/home/Downloads/myconfig.conf
To get help on available options run:
$ ./walletd -h
Please note, Fuego RPC Wallet config file may consist only of these options:
Option | Description | Config Example | Console Example |
---|---|---|---|
bind-address | Which address to bind Fuego RPC Wallet to. Default value is 0.0.0.0 | bind-address = 127.0.0.1 | --bind-address=127.0.0.1 |
bind-port | Which port to bind Fuego RPC Wallet to. Default value is 18180 | bind-port = 18181 | --bind-port=18181 |
dæmon-address | Fuego dæmon (fuegod) address for remote dæmon connection infrastructure | daemon-address = 127.0.0.1 | --daemon-address= 127.0.0.1 |
dæmon-port | Fuego dæmon (fuegod) port for remote connection. Default Fuego dæmon port is 18180 | daemon-port = 18180 | --daemon-port=18180 |
container-file | Mandatory. Your container's file name | container-file = mycontainer | --container-file=mycontainer |
container-password | Mandatory. Your container's password | container-password = mypassword | --container-password=mypassword |
log-file | A name of log file that you want to use for logging. Default is walletd.log | log-file = mylog.log | --log-file=mylog.log |
server-root | Working directory that you wish to use for Fuego RPC Wallet. Default is current working directory. | server-root = /home/Downloads/RPCWallet | --server-root=/home/Downloads/RPCWallet |
log-level | Level of logging. Default is 1. | log-level = 2 | --log-level=2 |
testnet | Allows you to run Fuego RPC Wallet in testnet. | testnet = no | --testnet=no |
local | Option that allows you to start Fuego RPC Wallet as an in-process node | local = true | --local |
Here's an example of a config file:
` $ cat rpc_wallet.conf `
`container-file = mycontainer` `container-password = mypassword` `daemon-port = 18180` `bind-port = 18181` `testnet = no`
You may specify Fuego config directly through console arguments. Here's the same example as above in console:
./walletd --container-file=mycontainer --container-password=mypassword --daemon-port=18180 --bind-port=18181 --testnet=no
Note: config file's path is relative to current working directory, not server root.
Note: options "container-file" and "container-password" should ALWAYS be set (in either command line or config file mode).
Note: "container-file" and "log-file" options are relative to "server-root". "server-root" default is the current working directory.
Fuego RPC wallet can be started in both daemon and console modes.
- Daemon mode - Fuego RPC Wallet is launched in the background, while you can continue to work with a console window.
- Console mode - Fuego RPC Wallet is launched and prints log messages on the screen.
To start RPC wallet as daemon just set "--daemon" (or short "-d") option.
./walletd --container-file=mycontainer --container-password=mypassword --daemon
Note: it's a common practice for daemons to set server root directory.
Server root is the directory where RPC Wallet stores all its files. All relative paths in RPC Wallet configuration are relative to the server root directory.
To run RPC wallet as a service on Windows you have to do the following:
1. Create a config file and place it in the same directory as your RPC wallet's executable resides in.
A note for Windows Users: In case the server root in config file is not specified all paths should be ABSOLUTE. If you set server root you can use relative paths (relative to your server root);
2. Register your Fuego Wallet as a service. To do so, run the following command as an ADMINISTRATOR:
` walletd.exe --register-service`
3. After you see message about successful service registration you can run it in your Services panel.
If you want to delete RPC wallet you have to unregister windows service first (if you have registered it before). Run as an ADMINISTRATOR:
walletd.exe --unregister-service
Fuego RPC Wallet API allows you to create addresses for your users, accept and send transactions and much more.
A detailed description for each API method of Fuego RPC Wallet can be found at RPC Wallet API methods