Archive of the libbitcoin Slack #general channel.
Happy 77th Birthday Silver Fox
balance
{
address mztCURLXppqDsUnk4XtebZAkq8sr93etgs
received 18446744073709551615
spent 18446744073709551615
}transaction
{
hash a041f7d7139debf75ade2d8ea7f7d22e88acfa9f6a4b08b8b5625dc0779af198
inputs
{
input
{
address_hash d46ef5fd67873ccbe43cd71ac55c4c3b335213e5
previous_output
{
hash 354b1eda7d1929a5105d0f16bbce76ec76c48097f79a6d6ae7e6ee67aff0c4cf
index 1
}
script "[3044022001d50b67bf020de1a22f808098ef467bc643217a5fee430e63c2f8d5a85894a0022047df7c0d15ddd2fa45e4068ca94ce8087bb260ac2bf33e6264a4d4f12251ce0b01] [033297c7e4f78310e53d9c732374267b4deeeb30b532bda0947e5269bffc3ceb4e]"
sequence 4294967295
}
}
lock_time 0
outputs
{
output
{
address_hash d46ef5fd67873ccbe43cd71ac55c4c3b335213e5
script "dup hash160 [d46ef5fd67873ccbe43cd71ac55c4c3b335213e5] equalverify checksig"
value 4399900000
}
output
{
script "return [486170707920373774682042697274686461792053696c76657220466f780a]"
value 0
}
}
version 1
}transfers
{
transfer
{
received
{
hash a041f7d7139debf75ade2d8ea7f7d22e88acfa9f6a4b08b8b5625dc0779af198
height 529179
index 0
}
value 4399900000
}
transfer
{
received
{
hash 354b1eda7d1929a5105d0f16bbce76ec76c48097f79a6d6ae7e6ee67aff0c4cf
height 509580
index 1
}
spent
{
hash a041f7d7139debf75ade2d8ea7f7d22e88acfa9f6a4b08b8b5625dc0779af198
height 529179
index 0
}
value 4400000000
}
transfer
{
received
{
hash 8c294512c98c463f0d4fb2476e8e517549ce1219c71b0eb0c79f632ed446fb5b
height 505549
index 0
}
spent
{
hash 354b1eda7d1929a5105d0f16bbce76ec76c48097f79a6d6ae7e6ee67aff0c4cf
height 509580
index 0
}
value 4900100000
}
transfer
{
spent
{
hash a041f7d7139debf75ade2d8ea7f7d22e88acfa9f6a4b08b8b5625dc0779af198
height 529179
index 0
}
value 18446744073709551615
}
transfer
{
spent
{
hash 354b1eda7d1929a5105d0f16bbce76ec76c48097f79a6d6ae7e6ee67aff0c4cf
height 509580
index 0
}
value 18446744073709551615
}
}transaction
{
hash 80eecb43742ab119a30121c8bf733fbb9bd4de95bcd50d35d1e33d6a328d6a90
inputs
{
input
{
address_hash d46ef5fd67873ccbe43cd71ac55c4c3b335213e5
previous_output
{
hash 354b1eda7d1929a5105d0f16bbce76ec76c48097f79a6d6ae7e6ee67aff0c4cf
index 1
}
script "[304402202c3a685e40e98df65fc45a3f504e4e4c4c00b4be56e2bba6ca9ae1e009a1180602205659957b593ff724fa69fab99729aa5981f5d86029b4198c61351735bad805f601] [033297c7e4f78310e53d9c732374267b4deeeb30b532bda0947e5269bffc3ceb4e]"
sequence 4294967295
}
}
lock_time 0
outputs
{
output
{
address_hash d46ef5fd67873ccbe43cd71ac55c4c3b335213e5
script "dup hash160 [d46ef5fd67873ccbe43cd71ac55c4c3b335213e5] equalverify checksig"
value 4399900000
}
output
{
address_hash abdc6bdb3646d67f6117047bbea7a419f1bf3578
script "hash160 [abdc6bdb3646d67f6117047bbea7a419f1bf3578] equal"
value 0
}
}
version 1
}486170707920373774682042697274686461792053696c76657220466f780a(edited)
return [486170707920373774682042697274686461792053696c76657220466f780a]
0 1 62
transaction
{
hash 9b4ff8d9045456d50d542599f801020a5e7c19e012bd77b2d3136184491b5e6f
inputs
{
input
{
address_hash d46ef5fd67873ccbe43cd71ac55c4c3b335213e5
previous_output
{
hash 354b1eda7d1929a5105d0f16bbce76ec76c48097f79a6d6ae7e6ee67aff0c4cf
index 1
}
script "[304402202c3a685e40e98df65fc45a3f504e4e4c4c00b4be56e2bba6ca9ae1e009a1180602205659957b593ff724fa69fab99729aa5981f5d86029b4198c61351735bad805f601] [033297c7e4f78310e53d9c732374267b4deeeb30b532bda0947e5269bffc3ceb4e]"
sequence 4294967295
}
}
lock_time 0
outputs
{
output
{
address_hash d46ef5fd67873ccbe43cd71ac55c4c3b335213e5
script "dup hash160 [d46ef5fd67873ccbe43cd71ac55c4c3b335213e5] equalverify checksig"
value 4399900000
}
output
{
script "return [486170707920373774682042697274686461792053696c76657220466f780a]"
value 0
}
}
version 1
}or a Base16 script
382Db9auK4UrFCzWc15Tu8GGCv2RLfVkmc
0014aefc3905c26f851f8c319b0050d493fbc3e83a18
transaction_pool_broadcast function I'd like to detect if it failed because of a network error (e.g. I could not reach the libbitcoin-server) or if the transaction failed validation.libbitcoin-client to talk to a libbitcoin-server instance. When I send a transaction using transaction_pool_broadcast to that instance, wouldn't that bs server do an initial validation on my transaction and return any of the numerous error codes if it found a problem? If so, how can I distinguish any such error from an error caused by connectivity problems? (the connection between my application and my bs instance)(and you distinguish based on the value of the error code).
...
auto on_error = [](const bc::code& ec) {
if (bc::is_network_error(ec)) {
// network error handling
}
if (bc::is_validation_error(ec)) {
// validation error handling
}
// do on_error
};
auto on_done = [](const bc::code& ec) {
if (bc::is_network_error(ec)) {
// network error handling
}
if (bc::is_validation_error(ec)) {
// validation error handling
}
// do on_done
};
client.transaction_pool_broadcast(on_error, on_done, transaction);
...
(edited)op eval codes? Presumably any of those can happen if there's something wrong with my script?script::is_pay_key_hash_pattern(...) and script::is_witness_program_pattern(...) right?diff --git a/Javascript-Query-Example.md b/Javascript-Query-Example.md
new file mode 100644
index 0000000..e333142
--- /dev/null
+++ b/Javascript-Query-Example.md
@@ -0,0 +1,75 @@
+### Fetch transaction:
+```js
+const zmq = require('zeromq');
+const pystruct = require('python-struct');
+const requester = zmq.socket('req');
+
+const endpoint = 'tcp://mainnet.libbitcoin.net:9091';
+
+requester.on('message', function(command, identifier, buffer) {
+ console.log(buffer.toString('hex').substr(8));
+ requester.close();
+});
+
+requester.setsockopt(zmq.ZMQ_RCVTIMEO, 5000);
+requester.setsockopt(zmq.ZMQ_SNDTIMEO, 5000);
+requester.connect(endpoint);
+
+const txhash = '60e030aba2f593caf913a7d96880ff227143bfc370d03dbaee37d582801ebd83';
+requester.send('blockchain.fetch_transaction2', zmq.ZMQ_SNDMORE);
+requester.send(pystruct.pack('I', 42), zmq.ZMQ_SNDMORE);
+requester.send(Buffer.from(txhash.match(/.{1,2}/g).reverse().join(''), 'hex'));
+
+```
+Output:
+```
+010000000181d06e4403b989d1e003def4944080e9537ef38e219f58a3856333050d72fe4a080000008b483045022100943e28772ef850587034b447a76c1eb918d63c82a4619a01a34cf32dee13807a02204cbe75c49f8ced0ebc373a6d8e7cb7ecab31369861d8997873b94bac13c379b3014104dbfb10dd8a498b3431f4c7041bbba82aa33146d40b7def4315e9e6df7424d527e762042f9fcc5450cbfc5f849bd3dace5cc9d9b3be8fadc3de92f96e303cf599ffffffff02a8101300000000001976a914b4dc57e35f93de9ec155872c1ad0136134fb08b188acbbe633000000000017a91461ec8bf07c6a3a04a08d1251d70178c1b3d273cc8700000000
+```
+
+### Fetch block header
+```js
+const zmq = require('zeromq');
+const pystruct = require('python-struct');
+const requester = zmq.socket('req');
+full filestruct ring_signature { ... proof_list proofs; }struct ring_signature { ... response_list responses; }--- Language: Cpp # BasedOnStyle: WebKit AccessModifierOffset: -4 AlignAfterOpenBracket: DontAlign AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Right AlignOperands: false AlignTrailingComments: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine BinPackArguments: true BinPackParameters: true BraceWrapping: AfterClass: true AfterControlStatement: true AfterEnum: true AfterFunction: true AfterNamespace: false AfterObjCDeclaration: false AfterStruct: true AfterUnion: true AfterExternBlock: false BeforeCatch: false BeforeElse: true IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true BreakBeforeBinaryOperators: None BreakBeforeBraces: Customfull file