Skip to content

Commit

Permalink
dogecoin
Browse files Browse the repository at this point in the history
  • Loading branch information
apezord committed Mar 3, 2023
1 parent acb8791 commit 6d319eb
Show file tree
Hide file tree
Showing 80 changed files with 1,662 additions and 1,886 deletions.
193 changes: 113 additions & 80 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "ord"
description = "◉ Ordinal wallet and block explorer"
name = "ord-dogecoin"
description = "◉ Ordinal wallet and block explorer for dogecoin"
version = "0.5.1"
license = "CC0-1.0"
edition = "2021"
autotests = false
homepage = "https://github.com/casey/ord"
repository = "https://github.com/casey/ord"
homepage = "https://github.com/apezord/ord-dogecoin"
repository = "https://github.com/apezord/ord-dogecoin"
autobins = false
rust-version = "1.67"

Expand Down Expand Up @@ -40,7 +40,7 @@ mime = "0.3.16"
mime_guess = "2.0.4"
miniscript = "9.0.0"
mp4 = "0.13.0"
ord-bitcoincore-rpc = "0.16.5"
bitcoincore-rpc = "0.16.0"
redb = "0.13.0"
regex = "1.6.0"
rss = "2.0.1"
Expand Down Expand Up @@ -78,3 +78,7 @@ path = "tests/lib.rs"

[build-dependencies]
pulldown-cmark = "0.9.2"

[patch.crates-io]
bitcoin = { git = "https://github.com/apezord/rust-dogecoin" }
bitcoincore-rpc = { git = "https://github.com/apezord/rust-dogecoincore-rpc" }
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,28 @@ ordinal degenerates.

Tune in to the [Twitch stream](https://www.twitch.tv/ordinalsofficial) to watch us work on this project!

Donate
------
BTC - `1GKa8TBGK9UkY5PrigiP5eixDeYAsmdBC4`

DOGE - `DNmrp12LfsVwy2Q2B5bvpQ1HU7zCAczYob`

Wallet
------

`ord` relies on Bitcoin Core for private key management and transaction signing.
`ord` relies on Dogecoin Core for private key management and transaction signing.
This has a number of implications that you must understand in order to use
`ord` wallet commands safely:

- Bitcoin Core is not aware of inscriptions and does not perform sat
control. Using `bitcoin-cli` commands and RPC calls with `ord` wallets may
- Dogecoin Core is not aware of inscriptions and does not perform sat
control. Using `dogecoin-cli` commands and RPC calls with `ord` wallets may
lead to loss of inscriptions.

- `ord wallet` commands automatically load the `ord` wallet given by the
`--wallet` option, which defaults to 'ord'. Keep in mind that after running
an `ord wallet` command, an `ord` wallet may be loaded.

- Because `ord` has access to your Bitcoin Core wallets, `ord` should not be
- Because `ord` has access to your Dogecoin Core wallets, `ord` should not be
used with wallets that contain a material amount of funds. Keep ordinal and
cardinal wallets segregated.

Expand Down Expand Up @@ -99,14 +105,14 @@ The default location for the `ord` binary once built is `./target/release/ord`.
Syncing
-------

`ord` requires a synced `bitcoind` node with `-txindex` to build the index of
satoshi locations. `ord` communicates with `bitcoind` via RPC.
`ord` requires a synced `dogecoind` node with `-txindex` to build the index of
satoshi locations. `ord` communicates with `dogecoind` via RPC.

If `bitcoind` is run locally by the same user, without additional
If `dogecoind` is run locally by the same user, without additional
configuration, `ord` should find it automatically by reading the `.cookie` file
from `bitcoind`'s datadir, and connecting using the default RPC port.
from `dogecoind`'s datadir, and connecting using the default RPC port.

If `bitcoind` is not on mainnet, is not run by the same user, has a non-default
If `dogecoind` is not on mainnet, is not run by the same user, has a non-default
datadir, or a non-default port, you'll need to pass additional flags to `ord`.
See `ord --help` for details.

Expand Down
2 changes: 1 addition & 1 deletion benchmark/checkout
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euxo pipefail
REV=$1

if [[ ! -d ord ]]; then
git clone https://github.com/casey/ord.git
git clone https://github.com/apezord/ord-dogecoin.git
fi

cd ord
Expand Down
15 changes: 15 additions & 0 deletions bin/install-dogecoin-core-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -euxo pipefail

version=1.14.6

wget \
-O dogecoin.tar.gz \
https://github.com/dogecoin/dogecoin/releases/download/v$version/dogecoin-$version-x86_64-linux-gnu.tar.gz

tar \
-xzvf dogecoin.tar.gz \
-C /usr/local/bin \
--strip-components 1 \
dogecoin-$version/bin/{dogecoin-cli,dogecoind}
6 changes: 3 additions & 3 deletions contrib/raw/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ create INPUT_TXID INPUT_VOUT OUTPUT_DESTINATION OUTPUT_AMOUNT:
set -euxo pipefail

bitcoin-cli createrawtransaction \
dogecoin-cli createrawtransaction \
'[
{
"txid": "{{INPUT_TXID}}",
Expand All @@ -18,7 +18,7 @@ create INPUT_TXID INPUT_VOUT OUTPUT_DESTINATION OUTPUT_AMOUNT:
> raw.hex

sign WALLET_NAME:
bitcoin-cli -rpcwallet={{WALLET_NAME}} signrawtransactionwithwallet `cat raw.hex` > signed.json
dogecoin-cli -rpcwallet={{WALLET_NAME}} signrawtransactionwithwallet `cat raw.hex` > signed.json

send:
bitcoin-cli sendrawtransaction `cat signed.json | jq '.hex' --raw-output`
dogecoin-cli sendrawtransaction `cat signed.json | jq '.hex' --raw-output`
2 changes: 1 addition & 1 deletion deploy/checkout
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHAIN=$2
DOMAIN=$3

if [[ ! -d ord ]]; then
git clone https://github.com/casey/ord.git
git clone https://github.com/apezord/ord-dogecoin.git
fi

cd ord
Expand Down
3 changes: 3 additions & 0 deletions deploy/dogecoin.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
datadir=/var/lib/dogecoind
maxmempool=1024
txindex=1
33 changes: 33 additions & 0 deletions deploy/dogecoind.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[Unit]
After=network-online.target
Description=Dogecoin daemon
Documentation=https://github.com/dogecoin/dogecoin/blob/master/doc/init.md
Wants=network-online.target

[Service]
ConfigurationDirectory=dogecoin
ConfigurationDirectoryMode=0710
ExecStart=/usr/local/bin/dogecoind \
-conf=/etc/dogecoin/dogecoin.conf \
-chain=${CHAIN}
ExecStartPre=/bin/chgrp dogecoin /etc/dogecoin
Group=dogecoin
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PermissionsStartOnly=true
PrivateDevices=true
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
Restart=on-failure
RuntimeDirectory=dogecoind
RuntimeDirectoryMode=0710
StateDirectory=dogecoind
StateDirectoryMode=0710
TimeoutStartSec=infinity
TimeoutStopSec=600
Type=simple
User=dogecoin

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion deploy/ord-dev.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AmbientCapabilities=CAP_NET_BIND_SERVICE
Environment=RUST_BACKTRACE=1
Environment=RUST_LOG=info
ExecStart=/usr/local/bin/ord-dev \
--bitcoin-data-dir /var/lib/bitcoind \
--dogecoin-data-dir /var/lib/dogecoind \
--chain ${CHAIN} \
--data-dir /var/lib/ord-dev \
--index-sats \
Expand Down
4 changes: 2 additions & 2 deletions deploy/ord.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ AmbientCapabilities=CAP_NET_BIND_SERVICE
Environment=RUST_BACKTRACE=1
Environment=RUST_LOG=info
ExecStart=/usr/local/bin/ord \
--bitcoin-data-dir /var/lib/bitcoind \
--dogecoin-data-dir /var/lib/dogecoind \
--data-dir /var/lib/ord \
--config-dir /var/lib/ord \
--chain ${CHAIN} \
--index-sats \
server \
--acme-contact mailto:[email protected] \
--acme-contact mailto:[email protected] \
--http \
--https
Group=ord
Expand Down
32 changes: 16 additions & 16 deletions deploy/setup
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ touch ~/.hushlogin
sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config

mkdir -p \
/etc/systemd/system/bitcoind.service.d \
/etc/systemd/system/dogecoind.service.d \
/etc/systemd/system/ord.service.d

printf "[Service]\nEnvironment=CHAIN=%s\n" $CHAIN \
| tee /etc/systemd/system/bitcoind.service.d/override.conf \
| tee /etc/systemd/system/dogecoind.service.d/override.conf \
> /etc/systemd/system/ord.service.d/override.conf

hostnamectl set-hostname $DOMAIN
Expand Down Expand Up @@ -54,11 +54,11 @@ esac

ufw --force enable

if ! which bitcoind; then
./bin/install-bitcoin-core-linux
if ! which dogecoind; then
./bin/install-dogecoin-core-linux
fi

bitcoind --version
dogecoind --version

if [[ ! -e ~/.cargo/env ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Expand All @@ -74,25 +74,25 @@ if [[ -f /usr/local/bin/ord ]]; then
fi
cp target/release/ord /usr/local/bin/ord

id --user bitcoin || useradd --system bitcoin
id --user dogecoin || useradd --system dogecoin
id --user ord || useradd --system ord

cp deploy/bitcoind.service /etc/systemd/system/
mkdir -p /etc/bitcoin
cp deploy/bitcoin.conf /etc/bitcoin/bitcoin.conf
cp deploy/dogecoind.service /etc/systemd/system/
mkdir -p /etc/dogecoin
cp deploy/dogecoin.conf /etc/dogecoin/dogecoin.conf
systemctl daemon-reload
systemctl enable bitcoind
systemctl restart bitcoind
systemctl enable dogecoind
systemctl restart dogecoind

case $CHAIN in
main)
COOKIE_FILE_DIR=/var/lib/bitcoind
COOKIE_FILE_DIR=/var/lib/dogecoind
;;
signet)
COOKIE_FILE_DIR=/var/lib/bitcoind/signet
COOKIE_FILE_DIR=/var/lib/dogecoind/signet
;;
test)
COOKIE_FILE_DIR=/var/lib/bitcoind/testnet3
COOKIE_FILE_DIR=/var/lib/dogecoind/testnet3
;;
*)
echo "Unknown chain: $CHAIN"
Expand All @@ -101,11 +101,11 @@ case $CHAIN in
esac

while [[ ! -f $COOKIE_FILE_DIR/.cookie ]]; do
echo "Waiting for bitcoind"
echo "Waiting for dogecoind"
sleep 1
done

setfacl -m ord:x /var/lib/bitcoind
setfacl -m ord:x /var/lib/dogecoind
setfacl -m ord:x $COOKIE_FILE_DIR
setfacl -dm ord:r $COOKIE_FILE_DIR
setfacl -m ord:r $COOKIE_FILE_DIR/.cookie
Expand Down
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ OPTIONS:
EOF
}

git=casey/ord
git=apezord/ord-dogecoin
crate=ord
url=https://github.com/casey/ord
url=https://github.com/apezord/ord-dogecoin
releases=$url/releases

say() {
Expand Down Expand Up @@ -98,7 +98,7 @@ if [ -z ${dest-} ]; then
fi

if [ -z ${tag-} ]; then
tag=$(curl --proto =https --tlsv1.2 -sSf https://api.github.com/repos/casey/ord/releases/latest |
tag=$(curl --proto =https --tlsv1.2 -sSf https://api.github.com/repos/apezord/ord-dogecoin/releases/latest |
grep tag_name |
cut -d'"' -f4
)
Expand All @@ -113,7 +113,7 @@ if [ -z ${target-} ]; then
x86_64-Linux) target=x86_64-unknown-linux-gnu;;
*)
err 'Could not determine target from output of `uname -m`-`uname -s`, please use `--target`:' $uname_target
err 'Please try building from source: https://github.com/casey/ord#building'
err 'Please try building from source: https://github.com/apezord/ord-dogecoin#building'
;;
esac
fi
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ publish revision='master':
#!/usr/bin/env bash
set -euxo pipefail
rm -rf tmp/release
git clone [email protected]:casey/ord.git tmp/release
git clone [email protected]:apezord/ord-dogecoin.git tmp/release
cd tmp/release
git checkout {{ revision }}
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
Expand Down
26 changes: 13 additions & 13 deletions quickstart/macos
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ fi
# check homebrew
brew --version

# install bitcoin
if ! command -v bitcoind; then
brew install bitcoin
# install dogecoin
if ! command -v dogecoind; then
brew install dogecoin
fi

# check bitcoind
bitcoind --version
# check dogecoind
dogecoind --version

# write config
if [[ ! -f ~/Library/Application\ Support/Bitcoin/bitcoin.conf ]]; then
printf 'txindex=1\nsignet=1\n' > ~/Library/Application\ Support/Bitcoin/bitcoin.conf
if [[ ! -f ~/Library/Application\ Support/Dogecoin/dogecoin.conf ]]; then
printf 'txindex=1\nsignet=1\n' > ~/Library/Application\ Support/Dogecoin/dogecoin.conf
fi

# start bitcoind
if ! bitcoin-cli getblockchaininfo; then
brew services start bitcoin
# start dogecoind
if ! dogecoin-cli getblockchaininfo; then
brew services start dogecoin
fi

# check bitcoind
bitcoin-cli getblockchaininfo | grep signet
# check dogecoind
dogecoin-cli getblockchaininfo | grep signet

# install ord
if ! command -v ord; then
curl --proto '=https' --tlsv1.2 -fsLS https://ordinals.com/install.sh | bash -s
curl --proto '=https' --tlsv1.2 -fsLS https://raw.githubusercontent.com/apezord/ord-dogecoin/master/install.sh?token=GHSAT0AAAAAAB657S54D565E7TB4B3NBCE4Y736PRQ | bash -s
fi

# check ord
Expand Down
Loading

0 comments on commit 6d319eb

Please sign in to comment.