Other plans than a command-line tool?

Hi,

I was wondering what the plans are in regard to making the block-chain available in other ways than through the current command-prompt tool concordium-client, e.g. something that is consumable from code in a “cleaner” way with a cleaner API?

Hi!

We have few different ways to interact with the blockchain from code:

We also have a few SDK’s that eases the interaction, depending on your choice of language:

  1. Typescript/Javascript: @concordium/node-sdk - npm
  2. Java: https://github.com/Concordium/concordium-java-sdk
  3. Rust: https://github.com/Concordium/concordium-rust-sdk

Note that these SDK’s are quite early in development, and they therefore only support a subset of the full capabilities of what is exposed by the node through the direct gRPC API.

I hope this helps.

I realize that this is beyond the scope of the Concordium “domain” but maybe you can quite easily point me in the right direction.

I’m interested in the gRPC API, since this is language independent (more or less) and I’m trying to test with BloomGPC (a Postman like tool) https://github.com/uw-labs/bloomrpc which imported the concordium_p2p_rpc.proto file with no problem, exposing all the methods and generated sample requests.

So far so good, but the requests fail and it may just be because I’m using wrong values, putting them in the wrong locations or failing to call the right methods in the right order.

My node has IP: 192.168.1.18, and listens to port: 10001

I’m trying to call NodeInfo which doesn’t take any arguments and I’m doing it by adding 192.168.1.18:10001 to the address field and sending the request.

Any ideas as to what I’m doing wrong here?

I get the following response:

{
  "error": "16 UNAUTHENTICATED: missing authentication token"
}

See picture below.
image

The node expects to be given an authentication token in the metadata.

The required value of this token can be configured on the node, but it defaults to rpcadmin.

I don’t know the BloomRPC tool, so I don’t how to provide metadata in that, but if can be provided in JSON-format you should use:

{
    "authentication": "rpcadmin"
}

as the metadata.

Thank you - just what I needed to make it work.
It turns out that BloomRPC has a metadata area where your token json object should be inserted.
I’m pretty new to gRPC, so I wasn’t looking for it.

Response

{
  "node_id": {
    "value": "04d2361fe01663c0"
  },
  "current_localtime": "1634723589",
  "peer_type": "Node",
  "consensus_baker_running": false,
  "consensus_running": true,
  "consensus_type": "Passive",
  "consensus_baker_committee": "NOT_IN_COMMITTEE",
  "consensus_finalizer_committee": false,
  "consensus_baker_id": null,
  "staging_net_username": null
}

Is there any particular order in which the methods should be called? - I see methods like PeerConnect and JoinNetwork, but I don’t see anything that has to do with smart contracts per say, like deploying, instantiating, updating a smart contract, or is this achieved via SendTransaction or similar?

It would be great with some documentation/guides for the gRPC API more than for the concordium-client, since I doubt anyone would base their solution on that.

Is this available anywhere or will it be coming? - I’m not talking about technical documentation but more like guides/samples of how to achieve various things with the API methods available.

Like if you want to deploy a smart contract, this is what you should do with the API and if you want to create an instance etc. etc.

Is something like this available somewhere or is it coming?

Interaction with smart contracts, on the chain, is done via transactions, so yes, for that, one would use SendTransaction.

I don’t think we are planning to add documentation/guides for the GRPC API.
But we are planning to expand the SDKs to support working with smart contracts, but I don’t know when this will be done.

Currently the closest thing to documentation on how to programmatically interact with smart contracts would be checking the concordium-client implementation, though I wouldn’t recommend it unless you are familiar with Haskell.

I’m interested in using another language (C#) than what you’re currently providing SDKs for, so my interest lays with direct communication with the gRPC API.

I appreciate the fact that you currently don’t support C# with your SDKs, which is also why I have asked on Stackoverflow.
I would still like to post a link to my issue here anyway, since someone here might be able to see what the problem is, even tough the language isn’t Rust nor Java.

It could very well be a simple thing because I’m a novice in regard to gRPC.

https://stackoverflow.com/questions/69657873/grpc-connect-to-concordium-blockchain-api-with-c-sharp

Hi again.

The node does not currently support secure connections, so I would expect that you would have to change:

using var channel = GrpcChannel.ForAddress("https://192.168.1.18:10001");

to

using var channel = GrpcChannel.ForAddress("192.168.1.18:10001");

You pointed me in the right direction thanks :slight_smile:

I just needed to add

AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

To allow non secure connection and then

using var channel = GrpcChannel.ForAddress("http://192.168.1.18:10001");

To make it work.