-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
504 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b2a7831f-e600-47fa-b995-0b3b6eae7380", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"extend_chain" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2ea42ca5-1a48-43c8-bc56-f726dbfe9e11", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"get_height" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5534de3b-0bf3-4862-bc54-142438eddd2b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"extend_chain num_blocks: 10" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "991fa262-76ee-4480-a072-ebdf26ee1c0a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"get_height" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Bitcoin DSL", | ||
"language": "ruby", | ||
"name": "ruby" | ||
}, | ||
"language_info": { | ||
"file_extension": ".rb", | ||
"mimetype": "application/x-ruby", | ||
"name": "ruby", | ||
"version": "3.2.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "aea6d72c-f5ea-446c-98d5-441cc46fc46c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"@coinbase = get_coinbase_at 1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "84247c3f-2951-469f-bd54-b2c71f94de20", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"@alice = key :new" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "bd93a56f-65d2-4952-952e-75fa7d96f9d5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"@bob = key :new" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "03436196-9609-4c13-9c23-4aa21d6d163b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"extend_chain to: @alice, num_blocks: 100" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "38d68447-bb7b-405b-94c2-bc4405b3d0c4", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"extend_chain" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b6757221-66f7-4031-9dbb-e5f7a8bbd4f0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"@alice_coinbase = spendable_coinbase_for @alice" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "813a0ea0-69be-49e6-a82f-8cd5e8e71b67", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"@alice_to_bob = transaction inputs: [ {tx: @alice_coinbase, vout: 0, script_sig: 'sig:wpkh(@alice)'} ],\n", | ||
" outputs: [ { amount: 49.99.sats, descriptor: 'wpkh(@bob)' } ]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5829e786-a456-425b-aee6-58dfef374eea", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"assert_mempool_accept @alice_to_bob" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3d041003-456f-41ad-925e-24a4e922df3f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"assert_output_is_not_spent transaction: @alice_coinbase, vout: 0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b6edc7f6-876f-46b5-a9ea-3c6865da8c5e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"broadcast @alice_to_bob" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "dd8e3b42-f00b-489f-8b8b-f015b595204f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"assert_mempool_accept @alice_to_bob" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "8ddc3434-0b79-4221-86ab-45589ba4eb1f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"confirm transaction: @alice_to_bob" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "52e14f12-a965-477c-b9e7-36b1ca5a78bc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"assert_output_is_spent transaction: @alice_coinbase, vout: 0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "801c47e7-c056-401e-8140-d056c132d42a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"assert_confirmations @alice_coinbase, confirmations: 1" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Bitcoin DSL", | ||
"language": "ruby", | ||
"name": "ruby" | ||
}, | ||
"language_info": { | ||
"file_extension": ".rb", | ||
"mimetype": "application/x-ruby", | ||
"name": "ruby", | ||
"version": "3.2.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
+*In[ ]:*+ | ||
[source, ruby] | ||
---- | ||
get_height | ||
---- | ||
|
||
|
||
+*In[ ]:*+ | ||
[source, ruby] | ||
---- | ||
getblockchaininfo | ||
---- | ||
|
||
|
||
+*In[ ]:*+ | ||
[source, ruby] | ||
---- | ||
@genesis = getblockhash height: 0 | ||
---- | ||
|
||
|
||
+*In[ ]:*+ | ||
[source, ruby] | ||
---- | ||
getblock blockhash: @genesis | ||
---- | ||
|
||
|
||
+*In[ ]:*+ | ||
[source, ruby] | ||
---- | ||
get_coinbase_at 0 | ||
---- | ||
|
||
|
||
+*In[ ]:*+ | ||
[source, ruby] | ||
---- | ||
|
||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a810b7db-9bc7-4d37-bf56-e546711e7a58", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"get_height" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f0e947d5-6b3b-4ce0-ab2f-4603b5dd4f12", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"getblockchaininfo" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f49406eb-787e-4ca9-9468-08a4ad975ef5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"@genesis = getblockhash height: 0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "cd6cad83-7d32-496c-8869-3054ed925cff", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"getblock blockhash: @genesis" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3096f412-af28-414f-afab-e2e48665774b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"get_coinbase_at 0" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Bitcoin DSL", | ||
"language": "ruby", | ||
"name": "ruby" | ||
}, | ||
"language_info": { | ||
"file_extension": ".rb", | ||
"mimetype": "application/x-ruby", | ||
"name": "ruby", | ||
"version": "3.2.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.