Skip to content

Instantly share code, notes, and snippets.

@grempe
Last active May 30, 2017 21:21
Show Gist options
  • Save grempe/8d4043995d2f4789d7980083d8417bdf to your computer and use it in GitHub Desktop.
Save grempe/8d4043995d2f4789d7980083d8417bdf to your computer and use it in GitHub Desktop.
We are starting bcoin with the command `bcoin --http-host=:: --host=:: --daemon` on a public server for testing. The bcoin.conf file is show below. This is a testnet instance.
# Sample bcoin config file (~/.bcoin/bcoin.conf)
#
# Options
#
network: testnet
use-workers: true
# max-workers: 4
# worker-timeout: 5000
# sigcache-size: 50000
#
# Node
#
#prefix: ~/.bcoin
db: leveldb
max-files: 64
cache-size: 100
#
# Logger
#
log-level: debug
log-console: true
log-file: true
#
# Chain
#
prune: false
checkpoints: true
coin-cache: 40
index-tx: false
index-address: false
#
# Mempool
#
mempool-size: 100
limit-free: true
limit-free-relay: 15
reject-absurd-fees: true
replace-by-fee: false
persistent-mempool: false
#
# Pool
#
selfish: false
compact: true
bip37: false
bip151: true
listen: true
max-outbound: 8
max-inbound: 30
# Proxy Server (browser=websockets, node=socks)
# proxy: foo:[email protected]:9050
# onion: true
# upnp: true
# Custom list of DNS seeds
# seeds: seed.bitcoin.sipa.be
seeds: testnet-seed.bitcoin.jonasschnelli.ch, seed.tbtc.petertodd.org, testnet-seed.bluematt.me, testnet-seed.bitcoin.schildbach.de
# Local Host & Port (to listen on)
host: ::
#port: 8333
# testnet 18333
port: 18333
# Public Host & Port (to advertise to peers)
# public-host: 1.2.3.4
# public-port: 8444
public-host: 52.206.180.64
public-port: 18444
# BIP151 AuthDB and Identity Key
bip150: false
identity-key: 74b4147957813b62cc8987f2b711ddb31f8cb46dcbf71502033da66053c8780a
# Always try to connect to these nodes.
# nodes: 127.0.0.1,127.0.0.2
#
# Miner
#
coinbase-flags: mined by bcoin
# coinbase-address: 1111111111111111111114oLvT2,1111111111111111111114oLvT2
preverify: false
max-block-weight: 4000000
reserved-block-weight: 4000
reserved-block-sigops: 400
#
# HTTP
#
# :: for ipv4 and ipv6
http-host: ::
#http-port: 8332
http-port: 18332
# ssl: true
# ssl-cert: @/ssl/cert.crt
# ssl-key: @/ssl/priv.key
service-key: REDACTED
api-key: REDACTED
wallet-auth: false
# no-auth: false
➜ ~ curl -X POST \
http://bcoin.staging.chainpoint.org:18332/wallet/primary/send \
-H 'authorization: Basic REDACTED' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: 22460395-da73-aea6-49a1-3fdfd54af690' \
-d '{
"token": "7f0c7414008a12871a9d76ad00ef8206151921f23649eb96fbeb67c4ab3e85cc",
"rate": "0.00020",
"outputs": [{
"value": "0",
"script": "6a207f0c7414008a12871a9d76ad00ef8206151921f23649eb96fbeb67c4ab3e85dd"
}]
}'
{
"wid": 1,
"id": "primary",
"hash": "6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9",
"height": -1,
"block": null,
"ts": 0,
"ps": 1496178644,
"date": "2017-05-30T21:10:44Z",
"index": -1,
"size": 234,
"virtualSize": 234,
"fee": "0.0000472",
"rate": "0.0002017",
"confirmations": 0,
"inputs": [
{
"value": "0.99953454",
"address": "mrboTgkduFhWYYXNyzUednfjaLV7zXJzya",
"path": {
"name": "default",
"account": 0,
"change": true,
"derivation": "m/0'/1/206"
}
}
],
"outputs": [
{
"value": "0.0",
"address": null,
"path": null
},
{
"value": "0.99948734",
"address": "mvkx9dkDcvLAmhPYrH8YByFsv7zQAdxx3b",
"path": {
"name": "default",
"account": 0,
"change": true,
"derivation": "m/0'/1/207"
}
}
],
"tx": "0100000001a9672286419242308d93651e4bb3f62410a10fb7d454a1ee3df0448c810df030010000006a473044022023b8680bc2650f0d71ef55e19fff5222fb1fa2bf42b3f8128602d5dbd6152f1b02204bbff3222bc0e2932cfd38377c95790af994c94779afe268d75117ed7d6999860121031e80e01cb928d42889167f442dd6d97e65aabeec2cc1826b64ceb3c51874228effffffff020000000000000000226a207f0c7414008a12871a9d76ad00ef8206151921f23649eb96fbeb67c4ab3e85ddbe18f505000000001976a914a72f96cb8018b53cd2f339580562d85d8018f98388ac00000000"
}
# relevant lines from debug log for test TX send with above curl command. Note especially the lines with 'TX was orphaned in mempool'
[D:2017-05-30T21:10:44Z] (http) Request for method=POST path=/primary/send (::ffff:68.173.147.255).
[I:2017-05-30T21:10:44Z] (wallet) Incoming transaction for 1 wallets in WalletDB (6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9).
[I:2017-05-30T21:10:44Z] (wallet) Added transaction to wallet in WalletDB: primary (1).
[D:2017-05-30T21:10:44Z] (wallet) Sending wallet tx (primary): 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9
[D:2017-05-30T21:10:44Z] (mempool) Added orphan 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 to mempool.
[W:2017-05-30T21:10:44Z] (node) TX was orphaned in mempool: 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9.
[W:2017-05-30T21:10:44Z] (node) Attempting to broadcast anyway...
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (107.22.136.152:46438).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (107.22.136.152:46438).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (47.89.188.149:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (47.89.188.149:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (45.79.85.218:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (45.79.85.218:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (45.33.46.133:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (45.33.46.133:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (52.10.6.141:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (52.10.6.141:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (144.76.136.19:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (144.76.136.19:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (80.100.203.151:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (80.100.203.151:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (109.235.65.88:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (109.235.65.88:18333).
[D:2017-05-30T21:10:45Z] (net) Peer requested tx 6fc7b74df44c7c592fbbd894ed13b7d2ff27cb69104ed95bd323a2a22bf55bd9 as a witness packet (94.79.54.206:18333).
[D:2017-05-30T21:10:45Z] (net) Served 1 txs with getdata (notfound=0) (94.79.54.206:18333).
[D:2017-05-30T21:11:14Z] (net) Requesting 1/1 txs from peer with getdata (45.79.85.218:18333).
[D:2017-05-30T21:11:14Z] (mempool) Added 4914a95abdf1b9d76931eb2621f95f1752df17e29518f0d087db45c314b28896 to mempool (txs=97).
[I:2017-05-30T21:11:17Z] (net) Received 1 addrs (hosts=1000, peers=10) (72.36.89.11:45214).
[D:2017-05-30T21:11:19Z] (net) Requesting 1/1 txs from peer with getdata (80.100.203.151:18333).
[D:2017-05-30T21:11:19Z] (mempool) Added 04bd707b7968b517f8ed5c692cf3322b7791cab5a1b96058dab63d211b5f7807 to mempool (txs=98).
[D:2017-05-30T21:11:44Z] (net) Requesting 3/3 txs from peer with getdata (45.33.46.133:18333).
[D:2017-05-30T21:11:44Z] (mempool) Added 4d5b78277787b3dac91bc0f1b6282c65eb1f0556cb98cab5c98c128cfe3faf8c to mempool (txs=99).
[D:2017-05-30T21:11:44Z] (mempool) Added be7dae4bdaa206dc57dcc671f6a7bd2994de1bbf66fd1b9115d7c7a584e4620e to mempool (txs=100).
[D:2017-05-30T21:11:44Z] (mempool) Added e3b99f3308b13517fe1ca40f948084e1b8d1bf559c329e5fe2c212e41eb9460b to mempool (txs=101).
[D:2017-05-30T21:11:46Z] (net) Requesting 1/1 txs from peer with getdata (45.33.46.133:18333).
[D:2017-05-30T21:11:46Z] (mempool) Added c093114d91dc5021d146913c4ff2f7ebb59776117163ca2db7ecd5afba07688d to mempool (txs=102).
# Tried to find TX on a testnet explorer looking for the input address and found nothing
https://www.blocktrail.com/tBTC/address/mrboTgkduFhWYYXNyzUednfjaLV7zXJzya
@grempe
Copy link
Author

grempe commented May 30, 2017

Brief description of issue in conversation with Steven:

First issue is around trying to send a TX to testnet using the /wallet/:id/send REST API. We see the TX show up on a testnet explorer sometimes, but not others (although in both cases we get back a full JSON structure from bcoin with a 200 response). In this case we are also seeing errors related to orhpan tx I believe on our server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment