Skip to content

Instantly share code, notes, and snippets.

@ramontayag
Last active June 6, 2021 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramontayag/173d28411d3e5a2f741d6dfc46a0d24c to your computer and use it in GitHub Desktop.
Save ramontayag/173d28411d3e5a2f741d6dfc46a0d24c to your computer and use it in GitHub Desktop.
lnd = Lnrpc::Client.new({
address: "127.0.0.1:10001",
credentials_path: "/Users/ramon/.polar/networks/1/volumes/lnd/alice/tls.cert",
macaroon_path: "/Users/ramon/.polar/networks/1/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon",
})
# This works
lnd.lightning.get_info
response = lnd.signer.sign_message({
msg: Lnrpc.to_byte_array("Hello, Jessica"), # assuming this is how it's encoded
key_loc: {
# https://github.com/lightningnetwork/lnd/blob/42099ef5e1e0f927290531fe2bff18406141567b/keychain/derivation.go#L85
key_family: 6,
# assuming idx is 0
key_index: 0
},
})
# This was generated via `lncli signmessage "Hello, Jessica"`
# on the alice node`
expected_signature = "d9aa91ggo54ouho9axcw3itokb5u697tigi1r8o1kq4qkx" \
"87acduoz5f5wnxyts8dt8emhie9r3gnkxkwo5ogzo5xwsrfkhzpg5qnnmh"
# How do I encode response.signature to show `expected_signature`?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment