How do I verify a signed message?

I really can’t find anywhere, even which algorithms the wallet uses to sign a message. I don’t understand what I’m missing, this should’ve been very simple.

No I don’t mean in a smart contract, just in any normal program.

I’ve seen this example https://github.com/Concordium/concordium-rust-smart-contracts/blob/main/examples/signature-verifier/src/lib.rs

but I don’t know how to get the public address to that format from the given format

Can you provide a few more details on which signatures you would like to verify?

Maybe a concrete example would help.

Concordium uses ed25519 signature scheme for all user-facing data.

Its not much, I’m just playing around, and signed a simple “hello” message with my testnet wallet.

and this is the signature, I’ve made this using the sign messages demo https://signmessage.testnet.concordium.com/
“88ddc1b0926c7e8c3993926361a20ce1325591e77cbd0fb262d39f16d162cc16f77ee960ad791b06b54f9fab41042a1fc0ec74b979b76b3d83309041c849b407”

and this is the test wallet public address
“3sHi2FD6vdHRe8UAwEuiPMvAZBYpHKZgiNSfDJ8GRL4ygTPno5”

now I’d like to verify the message, from these in any program/language just for testing, for now I’m trying on nodejs, or rust.

I can’t get them to verify, I think I’m missing some kind of format conversion or something. could you provide the steps to follow. I think I’m mostly confused with the public address format, as I can’t find any resources which format it uses, and went with bech32 decoding, to make a buffer/array and this is the hex value after decoding the public address from bech32

“7993cecf09dff59a26535aba451b6a6725393a590277ea37b9525d6b026a4e66”

am I doing this right?

I’m indeed trying to verify this message with ed25519. but I’m failing.

I even tried in here Ed25519 Online Tool, but I don’t know if its appropriate or not, as when I place my private key(test), the public key doesn’t match nor the signature.

I tried even hashing the message with sha256 before verifying. no luck.

Could anyone point out, where I’m going wrong. or provide proper instructions/steps for verifying a message, signed by a wallet. Thank you.

What I want to do ultimately, is sign “hello” send it to my backend, and verify that this “hello” is indeed signed by the expected wallet from its public address. I’m pretty new to this web3 stuff, so is that possible?

If you tell the wallet to sign message X then it produces the signature on the SHA256 hash of the following data

  • account address of the account that signed the message
  • 8 zero bytes to make the message distinct from a transaction
  • the message

So you should verify the signature on that.

See this draft PR I made some time ago Add a helper to verify message signatures produced by the wallets. by abizjak · Pull Request #349 · Concordium/concordium-base · GitHub

and never merged in due to other priorities.

Hey,

You can use grpc.testnet.concordium.com and port 20000.

If you want to run a node yourself you can download one from here: Downloads - Testnet — Concordium documentation

Hi,

You can do the following:

...
let mut client = v2::Client::new(Endpoint::from_static(
        "https://grpc.testnet.concordium.com:20000",
    ))
....

We have quite a few examples using the SDK you can consult for some inspiration:

In particular you should look at the “v2_*.rs” examples for usages of the v2 client.

You can even run these examples by executing the following command (from the root of the concordium-rust-sdk repository)

cargo run --release --example v2_get_module_list -- --node https://grpc.testnet.concordium.com:20000

For instance, this will run the v2_get_module_list.rs example.