-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
691d561
commit 6510e6b
Showing
19 changed files
with
1,030 additions
and
281 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
target/ | ||
network1/ | ||
**/*.rs.bk | ||
.DS_Store | ||
/data/ | ||
/target/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,21 +1,31 @@ | ||
MIT License | ||
DHARMA License | ||
|
||
Copyright (c) 2019 flyingw | ||
Copyright (c) 2019–2023 flyingw | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
YOU CANNOT USE THIS SOFTWARE IN ANY (PROVABLE BY MONEY TRACE) | ||
PROCESS CHAIN OF EXTERMINATING UKRAINIANS BY ANY MEANS OF FASCIST | ||
ACTIONS AGAINST OUR TERRITORIAL INTEGRITY, CULTURAL DIVERSITY BY | ||
APPLYING MILITARY INVASIONS, ECONOMICAL WARS, HUMANITARIAN DISASTERS, | ||
ARTFICIAL HOLODOMORS, GENOCIDE, RAPING, LOOTING, ROBBERIES, SPREADING | ||
FAKE INFORMATION, AND OTHER CONTEMPORARY WEAPONS OF WAR AT SCALE | ||
OR IN INVIDIVUAL MANNER. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
YOU CANNOT USE THIS SOFTWARE BY ANY MEANS IN INTEREST OF LEGAL | ||
ENTITIES OR INDIVIDUALS WHO IS SUPPORTING NOW OR WAS SUPPORTING | ||
BACK THEN FASCISM, RUSCISM, COMMUNISM, CHAUVINISM, HUMILIATION, | ||
AND OTHER SUPPRESSIVE IDEOLOGIES IN DIFFERENT EXPRESSIONS. | ||
|
||
STOP KILLING UKRAINIANS, | ||
THE COUNTER RENDERS TENS OF MILLIONS. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
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
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,132 @@ | ||
# setup | ||
|
||
```sh | ||
docker run -p 18444:18444 -p 18443:18443 -d --rm --name bitcoind -v "$PWD/data:/data" bitcoinsv/bitcoin-sv bitcoind | ||
|
||
vim ./data/bitcoin.conf | ||
... | ||
regtest=1 | ||
server=1 | ||
debug=1 | ||
rpcport=18443 | ||
|
||
docker stop bitcoind | ||
docker run -p 18444:18444 -p 18443:18443 -d --rm --name bitcoind -v "$PWD/data:/data" bitcoinsv/bitcoin-sv bitcoind | ||
|
||
brew install bitcoin | ||
|
||
touch ~/Library/Application\ Support/Bitcoin/bitcoin.conf | ||
vim ~/Library/Application\ Support/Bitcoin/bitcoin.conf | ||
regtest=1 | ||
rpcpassword=password | ||
rpcuser=bitcoin | ||
|
||
bitcoin-cli getnewaddress | ||
> mhCJckDWfFvNnK2bswTBxUW49JZvJ9ARaw (public key) | ||
|
||
bitcoin-cli generatetoaddress 200 "mhCJckDWfFvNnK2bswTBxUW49JZvJ9ARaw" | ||
|
||
bitcoin-cli dumpprivkey "mhCJckDWfFvNnK2bswTBxUW49JZvJ9ARaw" | ||
> cPgZDe7yAqmjDGK7vuvFrh79gjLKqGGBkuGiJrAEtmCKhJiNmCGd (private key) | ||
|
||
bitcoin-cli listunspent 0 | ||
> "txid": "1409b3059aca971958999e70df51749d14b4280e979165b4f24ff79ddcf58dfe", | ||
> "vout": 0, | ||
> "amount": 25.00000000, | ||
> "confirmations": 165, | ||
|
||
export BALANCE="25.00000000" | ||
export SECRET="cPgZDe7yAqmjDGK7vuvFrh79gjLKqGGBkuGiJrAEtmCKhJiNmCGd" | ||
export OUT_HSH="1409b3059aca971958999e70df51749d14b4280e979165b4f24ff79ddcf58dfe" | ||
export OUT_PNT="0" | ||
export DATA="68656c6c6f2c7361696c6f72" | ||
export NETWORK="bsv-reg" | ||
|
||
RUST_BACKTRACE=1 cargo run -- $NETWORK \ | ||
--in_address "" \ | ||
--in_amount $BALANCE \ | ||
--secret $SECRET \ | ||
--outpoint_hash $OUT_HSH \ | ||
--outpoint_index $OUT_PNT \ | ||
--out_address "" \ | ||
--change "0" \ | ||
--dust_address "" \ | ||
--dust_amount "0" \ | ||
--data $DATA | ||
> DEBUG - transaction hash: 1ddc1ecad78fa78007d2f80c6698c8f45ec32f4687fae40aee4d39bce3a74fc8 | ||
|
||
docker logs bitcoind | ||
|
||
bitcoin-cli gettransaction 1ddc1ecad78fa78007d2f80c6698c8f45ec32f4687fae40aee4d39bce3a74fc8 | ||
> "hex": "..." | ||
|
||
bitcoin-cli decoderawtransaction "..." | ||
> { | ||
> "value": 0.00, | ||
> "n": 0, | ||
> "scriptPubKey": { | ||
> "asm": "0 OP_RETURN 68656c6c6f2c7361696c6f72", | ||
> "hex": "006a0c68656c6c6f2c7361696c6f72", | ||
> "type": "nulldata" | ||
> } | ||
> }, | ||
|
||
echo 68656c6c6f2c7361696c6f72 | xxd -r -p | ||
> hello,sailor | ||
``` | ||
## mainnet | ||
```sh | ||
export MSG="..." # your message | ||
export DATA="$(echo $MSG | od -A n -t x1 | sed 's/ *//g')" | ||
export NETWORK="bsv" | ||
|
||
export ADDRESS="" | ||
curl --location $(echo 'https://api.whatsonchain.com/v1/bsv/main/address/'$ADDRESS'/unspent') | ||
|
||
export BALANCE="" | ||
export SECRET="" | ||
export OUT_HSH="" | ||
export OUT_PNT="" | ||
|
||
RUST_BACKTRACE=1 cargo run -- $NETWORK \ | ||
--in_address "" \ | ||
--in_amount $BALANCE \ | ||
--secret $SECRET \ | ||
--outpoint_hash $OUT_HSH \ | ||
--outpoint_index $OUT_PNT \ | ||
--out_address "" \ | ||
--change "0" \ | ||
--dust_address "" \ | ||
--dust_amount "0" \ | ||
--data $DATA | ||
``` | ||
### api | ||
``` | ||
curl --location 'https://api.whatsonchain.com/v1/bsv/main/tx/raw' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"txHex": "hex..." | ||
}' | ||
|
||
curl --location 'https://api.whatsonchain.com/v1/bsv/main/tx/hash/...' | ||
|
||
open https://whatsonchain.com/tx/... | ||
``` | ||
## notes | ||
```sh | ||
docker ps | ||
docker exec -it bitcoind bash | ||
docker run --rm --network container:bitcoind bitcoinsv/bitcoin-sv bitcoin-cli -regtest <cmd> | ||
docker logs --follow bitcoind | ||
|
||
bitcoin-cli getbalance | ||
bitcoin-cli setban "172.17.0.1" "remove" | ||
|
||
./test_bsv.sh | ||
``` |
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
Oops, something went wrong.