mirror of
https://github.com/Retropex/knots-startos.git
synced 2025-05-12 11:20:46 +02:00
Compare commits
7 Commits
431ecc587c
...
826b8117da
Author | SHA1 | Date | |
---|---|---|---|
826b8117da | |||
be06e8f538 | |||
6107317d87 | |||
5dc838cb86 | |||
2e7b73f8c7 | |||
f91aa51b5b | |||
f5d26600c6 |
@ -82,7 +82,12 @@ ENV PATH=${BITCOIN_PREFIX}/bin:$PATH
|
||||
COPY --from=bitcoin-core /opt /opt
|
||||
COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \
|
||||
./docker_entrypoint.sh \
|
||||
./actions/getaddress.sh \
|
||||
./actions/getbalance.sh \
|
||||
./actions/reindex.sh \
|
||||
./actions/sendcoin.sh \
|
||||
./actions/sendall.sh \
|
||||
./actions/signmessage.sh \
|
||||
./actions/reindex_chainstate.sh \
|
||||
./actions/prioritise-transaction.sh \
|
||||
./check-rpc.sh \
|
||||
|
23
actions/getaddress.sh
Normal file
23
actions/getaddress.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/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
|
||||
|
||||
ADDRESS=$(bitcoin-cli getnewaddress "" "bech32")
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"$ADDRESS\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
27
actions/getbalance.sh
Normal file
27
actions/getbalance.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/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
|
||||
|
||||
TRUSTED=$(bitcoin-cli getbalances | jq -r '.mine.trusted')
|
||||
UNTRUSTED=$(bitcoin-cli getbalances | jq -r '.mine.untrusted_pending')
|
||||
IMMATURE=$(bitcoin-cli getbalances | jq -r '.mine.immature')
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"Your wallet balance: $TRUSTED BTC. /
|
||||
Non confirmed balance: $UNTRUSTED BTC. /
|
||||
Immanture balance from mining: $IMMATURE BTC.\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
31
actions/sendall.sh
Normal file
31
actions/sendall.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/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)
|
||||
|
||||
FEE=$(jq -r '.["fee"]' input.json)
|
||||
if [ $FEE = "null" ]; then
|
||||
FEE="0"
|
||||
fi
|
||||
|
||||
TXID=$(bitcoin-cli -named sendall recipients="[\"$ADDRESS\"]" fee_rate=$FEE | jq -r '.txid')
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"txid: $TXID\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
36
actions/sendcoin.sh
Normal file
36
actions/sendcoin.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/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)
|
||||
|
||||
AMOUNT=$(jq -r '.["amount"]' input.json)
|
||||
if [ $AMOUNT = "null" ]; then
|
||||
AMOUNT="0"
|
||||
fi
|
||||
|
||||
FEE=$(jq -r '.["fee"]' input.json)
|
||||
if [ $FEE = "null" ]; then
|
||||
FEE="0"
|
||||
fi
|
||||
|
||||
TXID=$(bitcoin-cli -named sendtoaddress address=$ADDRESS amount=$AMOUNT fee_rate=$FEE)
|
||||
|
||||
result=" {
|
||||
\"version\": \"0\",
|
||||
\"message\": \"txid: $TXID\",
|
||||
\"value\": null,
|
||||
\"copyable\": true,
|
||||
\"qr\": false
|
||||
}"
|
||||
|
||||
echo $result
|
28
actions/signmessage.sh
Normal file
28
actions/signmessage.sh
Normal 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
|
127
manifest.yaml
127
manifest.yaml
@ -225,6 +225,133 @@ actions:
|
||||
range: "[-1000000,1000000]"
|
||||
default: 0
|
||||
nullable: true
|
||||
getaddress:
|
||||
name: "Get new address"
|
||||
description: "Get a new Bitcoin address."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: getaddress.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
getbalance:
|
||||
name: "Get wallet balance"
|
||||
description: "Get wallet balance."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: getbalance.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
sendcoin:
|
||||
name: "Send bitcoin"
|
||||
description: "Send bitcoin to an address."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: sendcoin.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
input-spec:
|
||||
address:
|
||||
type: string
|
||||
name: Address
|
||||
description: "The bitcoin address you want to send your bitcoins."
|
||||
placeholder: ""
|
||||
nullable: false
|
||||
amount:
|
||||
type: number
|
||||
name: Amount (BTC)
|
||||
description: "The amount of bitcoin you want to send to the address."
|
||||
integral: false
|
||||
range: "[0,21000000]"
|
||||
default: 0
|
||||
nullable: false
|
||||
fee:
|
||||
type: number
|
||||
name: Fee (sat/vbytes)
|
||||
description: "The amount of fee you want to pay for this transaction (in sat per vbytes)"
|
||||
integral: false
|
||||
range: "[0,1000000]"
|
||||
default: 0
|
||||
nullable: false
|
||||
sendall:
|
||||
name: "Send all bitcoin"
|
||||
description: "Send ALL bitcoin in the wallet."
|
||||
allowed-statuses:
|
||||
- running
|
||||
implementation:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: sendall.sh
|
||||
args: []
|
||||
io-format: json
|
||||
mounts:
|
||||
main: /root/.bitcoin
|
||||
inject: true
|
||||
input-spec:
|
||||
address:
|
||||
type: string
|
||||
name: Address
|
||||
description: "The bitcoin address you want to send your bitcoins."
|
||||
placeholder: ""
|
||||
nullable: false
|
||||
fee:
|
||||
type: number
|
||||
name: Fee (sat/vbytes)
|
||||
description: "The amount of fee you want to pay for this transaction (in sat per vbytes)"
|
||||
integral: false
|
||||
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:
|
||||
"*":
|
||||
|
Loading…
Reference in New Issue
Block a user