Merge pull request #33 from Retropex/sign
Some checks failed
Build Service / BuildPackage (push) Has been cancelled

add sign message action
This commit is contained in:
Léo Haf 2025-04-02 13:22:03 +02:00 committed by GitHub
commit 826b8117da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 0 deletions

View File

@ -87,6 +87,7 @@ COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \
./actions/reindex.sh \
./actions/sendcoin.sh \
./actions/sendall.sh \
./actions/signmessage.sh \
./actions/reindex_chainstate.sh \
./actions/prioritise-transaction.sh \
./check-rpc.sh \

28
actions/signmessage.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/sh
set -e
if ! bitcoin-cli listwalletdir | jq -e '.wallets[] | select(.name == "coin")' &> /dev/null; then
bitcoin-cli createwallet "coin" &> /dev/null
fi
if ! bitcoin-cli getwalletinfo &> /dev/null; then
bitcoin-cli loadwallet coin &> /dev/null
fi
cat > input.json
ADDRESS=$(jq -r '.["address"]' input.json)
MESSAGE=$(jq -r '.["message"]' input.json)
rm input.json
SIG=$(bitcoin-cli signmessage "$ADDRESS" "$MESSAGE")
result=" {
\"version\": \"0\",
\"message\": \"Signature: $SIG\",
\"value\": null,
\"copyable\": true,
\"qr\": false
}"
echo $result

View File

@ -323,6 +323,35 @@ actions:
range: "[0,1000000]"
default: 0
nullable: false
signmessage:
name: "Sign message"
description: "Sign a message with a bitcoin address."
allowed-statuses:
- running
implementation:
type: docker
image: main
system: false
entrypoint: signmessage.sh
args: []
io-format: json
mounts:
main: /root/.bitcoin
inject: true
input-spec:
address:
type: string
name: Address
description: "The bitcoin address to use to sign the message."
placeholder: ""
nullable: false
message:
type: string
name: Message
description: "The message to sign."
placeholder: ""
nullable: false
migrations:
from:
"*":