Skip to content

Instantly share code, notes, and snippets.

Oracle Explorer API

List all announcements

curl  -X GET http://localhost:9000/v2/announcements

This endpoint returns a JSON array of announcement objects.

const CScript redeemScript = std::get<0>(spk_keys);
const std::vector<CKey> keys = std::get<1>(spk_keys);
//hash the spk
const CScript p2sh = GetScriptForDestination(CScriptID(redeemScript));
//return sign(std::make_tuple(p2sh,keys));
const int inputIndex = 0;
//const CScript spk = std::get<0>(spk_keys);
//const std::vector<CKey> keys = std::get<1>(spk_keys);
CBasicKeyStore store;
for (const auto k: keys) {
"scriptSig": {
"asm": "5032504800000000000000000000000000000000d0
0000002040d6c07880b9d27e0c0056d5ed631e8fd0cc69ea257d2778a306ff5cb354ef71a4d3af4c96c81b208ba4ea85c6111381d09f0562501341cb7783262a961b4f88e8adbd58ffff7f200000000002000000020ddfc236182b5d23d1f098f62c5e84c0be6d364a7b5a1cad2d536987eb54957026eaf23d94a9a417a1777338b0039e5c160a1ab175d007d46693034d634619a60105 1 01000000013101107756ee12408d3bbdfc63f077ae8ca957eea5714ae9a4023cbd566cd0ea0000000049483045022100b204a2f4d73302cdb52ecfbd85dd85ae8395bf6de1c875c1eea96140763ede8d02207a31a84b17a546dca8af08a5f5c76be0da5eb35a013e2e5bbd0383c731a705ba01feffffff0228021024010000001976a914f596590deaf7f3afa453baf305d1cd7c7ca4523988ac00e1f5050000000017a914588ead1f4ba4e8b0b6b2da36f3f727296f46ee358765000000 1 1",
"hex": "285032504800000000000000000000000000000000d76885e2754fcd108c0204eab323e071e24e9a984c970000002040d6c07880b9d27e0c0056d5ed631e8fd0cc69ea257d2778a306ff5cb354ef71a4d3af4c96c81b208ba4ea85c6111381d09f0562501341cb7783262a961b4f88e8adbd58ffff7f20000
"asm": "06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f OP_WITHDRAWPROOFVERIFY"
/** Updates all of the given ts in the database */
def updateAll(ts: Seq[T]): Future[Seq[T]] = {
val query = findAll(ts)
val actions = ts.map(t => query.update(t))
val affectedRows: Future[Seq[Int]] = database.run(DBIO.sequence(actions))
val updatedTs = findAll(ts)
affectedRows.flatMap { _ =>
database.run(updatedTs.result)
}
}
(* If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
*
* Find the sum of all the multiples of 3 or 5 below 1000.
*)
let rec find_multiples counter accum =
let x = 3 * counter in
let y = 5 * counter in
if ((List.exists (fun a -> x == a) accum)) then
match (y < 1000) with
property("serialization symmetry") =
Prop.forAll(BlockchainElementsGenerator.blockHeader) { header =>
BlockHeader(header.hex) == header
}
trait BlockchainElementsGenerator {
def block : Gen[Block] = for {
header <- blockHeader
txs <- Gen.listOfN(randomNumber(10), TransactionGenerators.transactions)
} yield Block(header, txs)
def blockHeader : Gen[BlockHeader] = for {
version <- NumberGenerator.uInt32s
previousBlockHash <- CryptoGenerators.doubleSha256Digest
Script being executed: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c07703 02d5c25adb51b61339d2b05315791e21bbe80ea470a49db0135720983c905aace0
Op being executed: OP_UNKNOWN
Stack:
Op being executed: OP_UNKNOWN
Stack: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c0770320
Script being executed: OP_DUP OP_HASH160 e52b482f2faa8ecbf0db344f93c84ac908557f33 OP_EQUALVERIFY OP_CHECKSIG
Op being executed: OP_DUP
Stack: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c077032002d5c25adb51b61339d2b05315791e21bbe80ea470a49db0135720983c905aace020
Op being executed: OP_HASH160
Stack: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c077032002d5c25adb51b61339d2b053157
//prints the op code being executed & the stack state BEFORE op code execution
#include "utilstrencodings.h"
#include "streams.h"
#include "script.h"
cout << "Op being executed: " << GetOpName(opcode) << "\n";
for (unsigned int i = 0; i < stack.size(); i++) {
for (unsigned int j = 0; j < stack[i].size(); j++) {
ss << stack[i][j];
}