🤖

Tapyrusノード構築まとめ

2022/05/21に公開約7,300字

Tapyrus ノード構築まとめ

散らばったのでまとめ
Tapyrus Core v0.5.1

testnet

テストネットへの接続について

Ubuntu

# create data dir
$ sudo mkdir /var/lib/tapyrus-testnet

# create tapyrus.conf
$ cat <<EOF >  /etc/tapyrus/tapyrus-testnet.conf
networkid=1939510133
txindex=1
server=1
rest=1
rpcuser=user
rpcpassword=pass
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
addseeder=static-seed.tapyrus.dev.chaintope.com
fallbackfee=0.0002
EOF

# create genesis
$ cat <<EOF > /var/lib/tapyrus-testnet/genesis.1939510133
01000000000000000000000000000000000000000000000000000000000000000000000044cc181bd0e95c5b999a13d1fc0d193fa8223af97511ad2098217555a841b3518f18ec2536f0bb9d6d4834fcc712e9563840fe9f089db9e8fe890bffb82165849f52ba5e01210366262690cbdf648132ce0c088962c6361112582364ede120f3780ab73438fc4b402b1ed9996920f57a425f6f9797557c0e73d0c9fbafdebcaa796b136e0946ffa98d928f8130b6a572f83da39530b13784eeb7007465b673aa95091619e7ee208501010000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a010000002776a92231415132437447336a686f37385372457a4b6533766636647863456b4a74356e7a4188ac00000000
EOF

# start tapyrusd
$ tapyrusd -daemon -datadir=/var/lib/tapyrus-testnet -conf=/etc/tapyrus/tapyrus-testnet.conf

# 使うときは
$ tapyrus-cli -datadir=/var/lib/tapyrus-testnet -conf=/etc/tapyrus/tapyrus-testnet.conf getblockchaininfo

# ログの追い方
$ tail -f /var/lib/tapyrus-testnet/prod-1939510133/debug.log

# ---
# systemdを設定する場合
$ cat <<EOF > tapyrusd-testnet.service
[Unit]
Description=Tapyrus daemon (testnet)
After=network.target

[Service]
ExecStart=/usr/local/bin/tapyrusd -datadir=/var/lib/tapyrus-testnet -conf=/etc/tapyrus/tapyrus-testnet.conf
User=user
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

$ sudo mv tapyrusd-testnet.service /etc/systemd/system/tapyrusd-testnet.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable tapyrusd-testnet

Docker

# create tapyrus.conf
$ cat << EOF > tapyrus.conf
networkid=1939510133
txindex=1
server=1
rest=1
rpcuser=rpcuser
rpcpassword=rpcpassword
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
addseeder=static-seed.tapyrus.dev.chaintope.com
fallbackfee=0.0002
EOF

# run docker
$ docker run -d --name 'tapyrus_node_testnet' -v $PWD/tapyrus.conf:/etc/tapyrus/tapyrus.conf -e GENESIS_BLOCK_WITH_SIG='01000000000000000000000000000000000000000000000000000000000000000000000044cc181bd0e95c5b999a13d1fc0d193fa8223af97511ad2098217555a841b3518f18ec2536f0bb9d6d4834fcc712e9563840fe9f089db9e8fe890bffb82165849f52ba5e01210366262690cbdf648132ce0c088962c6361112582364ede120f3780ab73438fc4b402b1ed9996920f57a425f6f9797557c0e73d0c9fbafdebcaa796b136e0946ffa98d928f8130b6a572f83da39530b13784eeb7007465b673aa95091619e7ee208501010000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a010000002776a92231415132437447336a686f37385372457a4b6533766636647863456b4a74356e7a4188ac00000000' tapyrus/tapyrusd:v0.5.0

# 使うときは
$ docker exec tapyrus_node_testnet tapyrus-cli -conf=/etc/tapyrus/tapyrus.conf getblockchaininfo

もしくは:
$HOME/.tapyrus をデータディレクトリとする場合について

# create tapyrus.conf
$ cat << EOF > tapyrus.conf
networkid=1939510133
txindex=1
server=1
rest=1
rpcuser=rpcuser
rpcpassword=rpcpassword
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
addseeder=static-seed.tapyrus.dev.chaintope.com
fallbackfee=0.0002
EOF

# run docker
$ docker run -d --name 'tapyrus_node_testnet' -v $PWD/tapyrus.conf:/root/.tapyrus/tapyrus.conf -e CONF_DIR="/root/.tapyrus" -e DATA_DIR="/root/.tapyrus" -e GENESIS_BLOCK_WITH_SIG='01000000000000000000000000000000000000000000000000000000000000000000000044cc181bd0e95c5b999a13d1fc0d193fa8223af97511ad2098217555a841b3518f18ec2536f0bb9d6d4834fcc712e9563840fe9f089db9e8fe890bffb82165849f52ba5e01210366262690cbdf648132ce0c088962c6361112582364ede120f3780ab73438fc4b402b1ed9996920f57a425f6f9797557c0e73d0c9fbafdebcaa796b136e0946ffa98d928f8130b6a572f83da39530b13784eeb7007465b673aa95091619e7ee208501010000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a010000002776a92231415132437447336a686f37385372457a4b6533766636647863456b4a74356e7a4188ac00000000' tapyrus/tapyrusd:v0.5.1

# 使うときは
$ docker exec tapyrus_node_testnet tapyrus-cli getblockchaininfo

また docker exec コマンドが長くて鬱陶しい場合は -it オプションで bash をインタラクティブに操作することもできる。

$ docker exec -it tapyrus_node_testnet /bin/bash
root@ec5f4c4e49fb:/# tapyrus-cli getblockchaininfo

dev mode

genesis ブロックはtapyrus-core 内ドキュメントの物を利用するとします。

Ubuntu

# create data dir
$ sudo mkdir /var/lib/tapyrus-dev

# create tapyrus.conf
$ cat <<EOF >  /etc/tapyrus/tapyrus-dev.conf
rpcuser=rpcuser
rpcpassword=rpcpassword
bind=0.0.0.0
rpcallowip=0.0.0.0/0
server=1
keypool=1
discover=0
dev=1
[dev]
port=12383
rpcport=12381
networkid=1905960821
EOF

# create genesis
$ cat <<EOF > /var/lib/tapyrus-dev/genesis.1905960821
0100000000000000000000000000000000000000000000000000000000000000000000002b5331139c6bc8646bb4e5737c51378133f70b9712b75548cb3c05f9188670e7440d295e7300c5640730c4634402a3e66fb5d921f76b48d8972a484cc0361e66ef74f45e012103af80b90d25145da28c583359beb47b21796b2fe1a23c1511e443e7a64dfdb27d40e05f064662d6b9acf65ae416379d82e11a9b78cdeb3a316d1057cd2780e3727f70a61f901d10acbe349cd11e04aa6b4351e782c44670aefbe138e99a5ce75ace01010000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a010000001976a91445d405b9ed450fec89044f9b7a99a4ef6fe2cd3f88ac00000000
EOF

# start tapyrusd
$ tapyrusd -daemon -datadir=/var/lib/tapyrus-dev -conf=/etc/tapyrus/tapyrus-dev.conf

# 使うときは
$ tapyrus-cli -datadir=/var/lib/tapyrus-dev -conf=/etc/tapyrus/tapyrus-dev.conf getblockchaininfo

# ログの追い方
$ tail -f /var/lib/tapyrus-dev/prod-1905960821/debug.log

# ---
# systemdを設定する場合
$ cat <<EOF > tapyrusd-dev.service
[Unit]
Description=Tapyrus daemon (dev)
After=network.target

[Service]
ExecStart=/usr/local/bin/tapyrusd -datadir=/var/lib/tapyrus-dev -conf=/etc/tapyrus/tapyrus-dev.conf
User=user
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

$ sudo mv tapyrusd-dev.service /etc/systemd/system/tapyrusd-dev.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable tapyrusd-dev

Docker

$HOME/.tapyrus をデータディレクトリとする場合について

# create tapyrus.conf
$ cat << EOF > tapyrus.conf
rpcuser=rpcuser
rpcpassword=rpcpassword
bind=0.0.0.0
rpcallowip=0.0.0.0/0
server=1
keypool=1
discover=0
dev=1
[dev]
port=12383
rpcport=12381
networkid=1905960821
EOF

# run docker
$ docker run -d --name 'tapyrus_node_dev' -v $PWD/tapyrus.conf:/root/.tapyrus/tapyrus.conf -e CONF_DIR="/root/.tapyrus" -e DATA_DIR="/root/.tapyrus" -e GENESIS_BLOCK_WITH_SIG='0100000000000000000000000000000000000000000000000000000000000000000000002b5331139c6bc8646bb4e5737c51378133f70b9712b75548cb3c05f9188670e7440d295e7300c5640730c4634402a3e66fb5d921f76b48d8972a484cc0361e66ef74f45e012103af80b90d25145da28c583359beb47b21796b2fe1a23c1511e443e7a64dfdb27d40e05f064662d6b9acf65ae416379d82e11a9b78cdeb3a316d1057cd2780e3727f70a61f901d10acbe349cd11e04aa6b4351e782c44670aefbe138e99a5ce75ace01010000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a010000001976a91445d405b9ed450fec89044f9b7a99a4ef6fe2cd3f88ac00000000' tapyrus/tapyrusd:v0.5.1

# 使うときは
$ docker exec tapyrus_node_dev tapyrus-cli getblockchaininfo
GitHubで編集を提案

Discussion

ログインするとコメントできます