Generated Substrate NET SDK
This is a NET playground repo for the published monthly substrate tags. To build towards a specific node, please follow the documentation in the Ajuna.SDK repo.
Currently you should find for the most actual monthly build a pre-generated tag in this repo, so make sure you chose a supported monthly substrate tag (ex. monthly-2022-11)
git clone -b monthly-2022-11 --single-branch https://github.com/paritytech/substrate.git
cargo build -p node-cli --release
./target/release/substrate --devUse the same tag for the SubstrateNET.
git clone -b monthly-2022-11 --single-branch https://github.com/ajuna-network/SubstrateNET.gitLoad solution SubstrateNET.sln
Execute SubstrateNET.RestService
- might ask you to accept certificates for ssl
- Rest API: http://localhost:61752/swagger/index.html
- WebSocket: http://localhost:61752/ws
A simple Program.cs to start hacking!
start hacking with the SDK
usingSystem;usingSystem.Threading;usingSystem.Threading.Tasks;usingSerilog;namespaceAjuna.NetApi.RunConsole{internalclassProgram{privatestaticasyncTaskMain(string[]args){varconfig=newLoggerConfiguration();Log.Logger=config.MinimumLevel.Debug().WriteTo.Console().CreateLogger();// CancellationToken that is canceled when the user hits Ctrl+C.varcts=newCancellationTokenSource();Console.CancelKeyPress+=(s,e)=>{Console.WriteLine("Canceling...");cts.Cancel();e.Cancel=true;};try{Console.WriteLine("Press Ctrl+C to end.");awaitMainAsync(cts.Token);}catch(OperationCanceledException){// This is the normal way we close.}}privatestaticasyncTaskMainAsync(CancellationTokentoken){varsubstrateClient=newSubstrateClient(newUri("ws://127.0.0.1:9944"));awaitsubstrateClient.ConnectAsync(true,CancellationToken.None);Log.Information("substrateClient.IsConnected: {IsConnected}",substrateClient.IsConnected);varblockData=awaitsubstrateClient.Chain.GetBlockAsync();Log.Information("blockData: {blockData}",blockData);}}}