It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
#!/bin/bash -eu
BITCOIND="bitcoind"
#BITCOIND="bitcoind -testnet"
if [ $# -ne 1 ]
then
echo "Command to change the locktime of a bitcoin transaction provided on standard input"
echo " Usage: ... | $0 ''"
echo " Example: btc-spend-all | $0 'tomorrow'"
exit 1
fi
## I usually use this script in a pipeline with btc-spend-all, i.e.:
## btc-spend-all | btc-change-locktime tomorrow | bitcoind signrawtransaction $(cat)
## or
## echo '01000000017f286f35362457e961925835bff28351e0b679c7810827396c76967712a6714d0000000000ffffffff0100e1f505000000001976a9144c56a8926eeb911b06575be05bad06e66463fb1e88ac00000000' | btc-change-locktime
## Load the raw transaction from standard in
RAW_TRANSACTION=$(cat)
## Get the desired locktime in human-readable format and convert it into
## epoch time in both decimal format and little-endian hexadecimal format
LOCKTIME_DECIMAL=$( date +%s -ud "$1" ) || { echo 'Invalid date' ; exit 1 ; }
LOCKTIME_HEX=$( echo $LOCKTIME_DECIMAL | awk '{ printf "%x", $1 }' | sed 's/^\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/' )
#### SAMPLE TRANSACTION
# 01000000017f286f35362457e961925835bff28351e0b679c7810827396c76967712a6714d0000000000ffffffff0100e1f505000000001976a9144c56a8926eeb911b06575be05bad06e66463fb1e88ac00000000
#### Every two characters (char) in hex equals one byte
# 01000000 .............................Version (8 char)
# 01 ...................................Vin count (2 char)
# 7f286f35362457e961925835bff28351e0b679c7810827396c76967712a6714d ...Prevout hash (64 char)
# 00000000 .............................Prevout index (8 char)
# 00 ...................................Signature script length (2 char)
# ffffffff .............................**Sequence number** (8 char)
# ++++++++++++++++++++++++++++++++++++++[[[[ additional inputs can go here ]]]]
# 01 ...................................vout count (2 char)
# 00e1f50500000000 .....................satoshis to transfer to send in this output (16 char)
# 19 ...................................public key length (2 char)
# 76a9144c56a8926eeb911b06575be05bad06e66463fb1e88ac public key claim script (50 char)
# ++++++++++++++++++++++++++++++++++++++[[[[ additional outputs can go here ]]]]
# 00000000 .............................**locktime** (8 char)
## Modify the transaction
MODIFIED_TRANSACTION=$(
echo $RAW_TRANSACTION | sed '''
## createrawtransaction by default creates transactions with
## max-value sequence numbers, which prevents locktime from having
## any effect. We need to change one of these sequence numbers to a
## lower value. Since the first sequence number always appears in
## the same byte location within the encoded transaction (after 84
## hexits), we will reduce it down to zero.
s/\(.\{84\}\)ffffffff/\100000000/;
## Now we need to set locktime to the earliest date when we want to
## be able to spend the bitcoins. Locktime is always the last 8
## hexits of the encode transaction, and by default it is set to zero.
s/00000000$/'$LOCKTIME_HEX'/;
'''
)
## Pre-build the decode command so we can reuse it several times
_dc_cmd="$BITCOIND decoderawtransaction"
## Now lets diff the original and modified transactions to test for changes.
## The diff should always produce 11 lines of output: a two-line header
## listing the file names, three one-line headers for each changed part,
## and three two-line diffs
_diff_line_count=$( eval diff -u0 <( $_dc_cmd $RAW_TRANSACTION ) <( $_dc_cmd $MODIFIED_TRANSACTION ) | wc -l )
if [ $_diff_line_count -ne 11 ]
then
echo Unexpected output from the diff command. Dying...
exit 1
fi
## Now test that all of the expected changes were made
eval diff -u0 <( $_dc_cmd $RAW_TRANSACTION ) <( $_dc_cmd $MODIFIED_TRANSACTION ) \
| egrep -v '^(---|\+\+\+|@@) ' \
| sed '''
## Whitelist all of the expected changes in the diff by
## deleting them so we can then test for unexpected changes
#
## The new locktime should decode to the decimal locktime
/^+.*"locktime".*'$LOCKTIME_DECIMAL'/d;
## The old locktime should have been zero
/^-.*"locktime".* 0,/d;
## The new sequence should be zero
/^+.*"sequence".* 0$/d;
## The old sequence should have been the maximum, 4294967295
/^-.*"sequence".* 4294967295/d;
## The only thing left should be the automatically-computerd
## txid hashes
/"txid" : /d
## If anything remains, somenthing went wrong
''' | grep . && { echo "Unexpected changes. Dying..." ; exit 1 ; }
## If we get here, all of the tests have been passed, so give the user
## the modified transaction so they can sign it
echo $MODIFIED_TRANSACTION
0100000001f699454faacb036aab2411e38ea00f5db9ffa7e831432c8945e8f0e21c7f26620000000000ffffffff0228397100000000001976a914b0c8172cbdc5ef9962574fbf945d7d39b4f2738788ac40420f00000000001976a914c37e2eb773d2314f92dc078f0c3a8277accc65f588ac8c560400010000000137268479bae60a643efbc656957b3e18d328d373af03db164633a1c63eb3fa38010000008b483045022100da354c1d60683b69656bb9c8e5d1f0c39a1c2c7d06ee0058b8f1dd4f455e41a50220063268fbf586095994a0b5cb2c1369a4a2bd365b83dd262baf992d1f81cfeac901410431676a8a5bd9629598daf9bd8249d4d6ce8298dbf26bb5d9cd7e3092d3c12be051c8bce0a4ecf6ec219e6b99259c5256641a7c00d18e2c48e728f4fdc0705438ffffffff02687b8000000000001976a914e6e58a7f6393bd51adaf6865ada8ca151ecd30b588ac46fe620d000000001976a914079c4a24d14153c77aa71a3ca451afd60fcc119388ac00000000
{
"txid" : "4aea2297b036092db495296ceeb5921b47b111b605942db360fc44fbd12e0193",
"version" : 1,
"locktime" : 284300,
"vin" : [
{
"txid" : "62267f1ce2f0e845892c4331e8a7ffb95d0fa08ee31124ab6a03cbaa4f4599f6",
"vout" : 0,
"scriptSig" : {
"asm" : "",
"hex" : ""
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 0.07420200,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 b0c8172cbdc5ef9962574fbf945d7d39b4f27387 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a914b0c8172cbdc5ef9962574fbf945d7d39b4f2738788ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"1H7jdJ9bfkoj45pnwrXyJ7xxCeJx3Mmfx6"
]
}
},
{
"value" : 0.01000000,
"n" : 1,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 c37e2eb773d2314f92dc078f0c3a8277accc65f5 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a914c37e2eb773d2314f92dc078f0c3a8277accc65f588ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"1JpfvikTE3jF3YG9XPswibceZMfGVi4nFa"
]
}
}
]
}
0100000001f699454faacb036aab2411e38ea00f5db9ffa7e831432c8945e8f0e21c7f26620000000000ffffffff0228397100000000001976a914b0c8172cbdc5ef9962574fbf945d7d39b4f2738788ac40420f00000000001976a914c37e2eb773d2314f92dc078f0c3a8277accc65f588ac00000000010000000137268479bae60a643efbc656957b3e18d328d373af03db164633a1c63eb3fa38010000008b483045022100da354c1d60683b69656bb9c8e5d1f0c39a1c2c7d06ee0058b8f1dd4f455e41a50220063268fbf586095994a0b5cb2c1369a4a2bd365b83dd262baf992d1f81cfeac901410431676a8a5bd9629598daf9bd8249d4d6ce8298dbf26bb5d9cd7e3092d3c12be051c8bce0a4ecf6ec219e6b99259c5256641a7c00d18e2c48e728f4fdc0705438ffffffff02687b8000000000001976a914e6e58a7f6393bd51adaf6865ada8ca151ecd30b588ac46fe620d000000001976a914079c4a24d14153c77aa71a3ca451afd60fcc119388ac00000000

{
"txid": "2150f5a18448b5cafe5f0a41d8c61606178d52fca52a8e53f486a288dd433caa",
"version": 1,
"locktime": 0,
"vin": [{
"txid": "62267f1ce2f0e845892c4331e8a7ffb95d0fa08ee31124ab6a03cbaa4f4599f6",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}],
"vout": [{
"value": 0.07420200,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 b0c8172cbdc5ef9962574fbf945d7d39b4f27387 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914b0c8172cbdc5ef9962574fbf945d7d39b4f2738788ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"1H7jdJ9bfkoj45pnwrXyJ7xxCeJx3Mmfx6"
]
}
}, {
"value": 0.01000000,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 c37e2eb773d2314f92dc078f0c3a8277accc65f5 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914c37e2eb773d2314f92dc078f0c3a8277accc65f588ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"1JpfvikTE3jF3YG9XPswibceZMfGVi4nFa"
]
}
}]
}

{
"txid": "2150f5a18448b5cafe5f0a41d8c61606178d52fca52a8e53f486a288dd433caa",
"version": 1,
"locktime": 284300,
"vin": [{
"txid": "62267f1ce2f0e845892c4331e8a7ffb95d0fa08ee31124ab6a03cbaa4f4599f6",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}],
"vout": [{
"value": 0.07420200,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 b0c8172cbdc5ef9962574fbf945d7d39b4f27387 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914b0c8172cbdc5ef9962574fbf945d7d39b4f2738788ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"1H7jdJ9bfkoj45pnwrXyJ7xxCeJx3Mmfx6"
]
}
}, {
"value": 0.01000000,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 c37e2eb773d2314f92dc078f0c3a8277accc65f5 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914c37e2eb773d2314f92dc078f0c3a8277accc65f588ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"1JpfvikTE3jF3YG9XPswibceZMfGVi4nFa"
]
}
}]
}