Setting up the Stratis or Bitcoin Full Node for development
Download the source code
Clone the StratisBitcoinFullNode code from https://github.com/stratisproject/StratisBitcoinFullNode
You need to have git installed, or a git GUI like Sourcetree or Github Desktop. Search google for “git clone” if you need help on this process.
This source code can run a Bitcoin node or a Stratis node.
Build source code
Open the full node solution in the cloned directory in Visual Studio Community edition.
Use the “Build all” command in Visual Studio.
Explore the code
If you want to run a Stratis node, go to the Stratis.StratisD “project” within the full node solution. Otherwise to run a Bitcoin node, go to the Stratis.BitcoinD “project”.
Go to Program.cs. This is a simple project that just starts a full node.
Go to launchsettings.json. This is a configuration file that shows several possible “dotnet run” profiles.
Run the code
Let’s run the StratisD/BitcoinD full node.
Open terminal window and navigate to the where the code is stored. (Navigating in a terminal window is done with “cd” commands. Use Google to find out more if you are unfamiliar with how to use a terminal.) Go to /src/Stratis.StratisD (or BitcoinD) folder within the full node code’s folder. Run the command “dotnet restore”, followed by “dotnet run -help”. All the possible command line arguments for this applications are shown.
Let’s run the full node with default settings. Enter the command “dotnet run”. The node starts up and logs various things to the terminal about it’s progress.
Use the API with Swagger
After the node has finished starting up, and then go to the swagger web interface to the node’s API at http://localhost:37221/swagger
Click on the GET /api/Node/status to expand it, and then click on the “Try it out!” button. This interface is used to manually test the API exposed by the full node. Explore the available endpoints - you can learn a lot about what the API can do from this screen.
Go back to the terminal window and hit ctrl+C several times to cancel the running of the full node.
Run the node with RPC turned on
Let’s run it again, but this time with the RPC server enabled. Run the command:
dotnet run -server=1 -rpcuser=user -rpcpassword=pass
Now the RPC server is active. Depending on how you develop your application you can decide whether to use the RPC server or the API.
The Full Node that is running right now downloads the Stratis or Bitcoin blockchain, and then stays running while it awaits for commands from the API. Some of the things you can do with the Full Node API are manage your wallets, receive and send Stratis/Bitcoin information, and retrieve information about past transactions.