diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-bitcoinrpc.spec | 378 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 380 insertions, 0 deletions
@@ -0,0 +1 @@ +/bitcoinrpc-0.5.0.tar.gz diff --git a/python-bitcoinrpc.spec b/python-bitcoinrpc.spec new file mode 100644 index 0000000..1cc5ce3 --- /dev/null +++ b/python-bitcoinrpc.spec @@ -0,0 +1,378 @@ +%global _empty_manifest_terminate_build 0 +Name: python-bitcoinrpc +Version: 0.5.0 +Release: 1 +Summary: Lightweight Bitcoin JSON-RPC Python asynchronous client +License: MIT +URL: https://github.com/bibajz/bitcoin-python-async-rpc +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/02/8b/7e35c470572be3605f10dac9b5d2ed4fae02747028c4a240d916c541be38/bitcoinrpc-0.5.0.tar.gz +BuildArch: noarch + +Requires: python3-orjson +Requires: python3-httpx +Requires: python3-typing-extensions + +%description +# bitcoin-python-async-rpc +Lightweight Bitcoin async JSON-RPC Python client. + +Serves as a tiny layer between an application and a Bitcoin daemon, its primary usage +is querying the current state of Bitcoin blockchain, network stats, transactions... + +If you want complete Bitcoin experience in Python, consult +[python-bitcoinlib](https://github.com/petertodd/python-bitcoinlib). + +## Installation +```bash +$ pip install bitcoinrpc +``` + +## Supported methods +Here is a list of supported methods, divided by their categories. Should you need +method not implemented, wrap the call in `BitcoinRPC.acall(<your_method>, ...)` coroutine. + +### Blockchain + +| Method | Supported? | +|------------|:----------------:| +| `getbestblockhash` | ✔ | +| `getblock` | ✔ | +| `getblockchaininfo` | ✔ | +| `getblockcount` | ✔ | +| `getblockhash` | ✔ | +| `getblockheader` | ✔ | +| `getblockstats` | ✔ | +| `getchaintips` | ✔ | +| `getdifficulty` | ✔ | +| `getmempoolinfo` | ✔ | +| `getnetworkhashps` | ✔ | + +### Mining + +| Method | Supported? | +|------------|:----------------:| +| `getmininginfo` | ✔ | + +### Network + +| Method | Supported? | +|------------|:----------------:| +| `getconnectioncount` | ✔ | +| `getnetworkinfo` | ✔ | + +### Raw transactions + +| Method | Supported? | +|------------|:----------------:| +| `getrawtransaction` | ✔ | + +## Usage +Minimal illustration (assuming Python 3.8+, where you can run `async` code in console) + +``` +$ python -m asyncio +>>> import asyncio +>>> +>>> from bitcoinrpc import BitcoinRPC +>>> rpc = BitcoinRPC("http://localhost:18443" "rpc_user", "rpc_passwd") +>>> await rpc.getconnectioncount() +10 +>>> await rpc.aclose() # Clean-up resource +``` + +You can also use the `BitcoinRPC` as an asynchronous context manager, which does +all the resource clean-up automatically, as the following example shows: + +``` +$ cat btc_rpc_minimal.py +import asyncio + +from bitcoinrpc import BitcoinRPC + + +async def main(): + async with BitcoinRPC("http://localhost:18443", "rpc_user", "rpc_password") as rpc: + print(await rpc.getconnectioncount()) + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +Running this script yields: +``` +$ python btc_rpc_minimal.py +10 +``` + +## Changelog + +- **2021/12/28 - 0.5.0** change the signature of `BitcoinRPC` from `host, port, ...` to `url, ...`, delegating the creation of the node url to the caller. + + +## License +MIT + + + + +%package -n python3-bitcoinrpc +Summary: Lightweight Bitcoin JSON-RPC Python asynchronous client +Provides: python-bitcoinrpc +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-bitcoinrpc +# bitcoin-python-async-rpc +Lightweight Bitcoin async JSON-RPC Python client. + +Serves as a tiny layer between an application and a Bitcoin daemon, its primary usage +is querying the current state of Bitcoin blockchain, network stats, transactions... + +If you want complete Bitcoin experience in Python, consult +[python-bitcoinlib](https://github.com/petertodd/python-bitcoinlib). + +## Installation +```bash +$ pip install bitcoinrpc +``` + +## Supported methods +Here is a list of supported methods, divided by their categories. Should you need +method not implemented, wrap the call in `BitcoinRPC.acall(<your_method>, ...)` coroutine. + +### Blockchain + +| Method | Supported? | +|------------|:----------------:| +| `getbestblockhash` | ✔ | +| `getblock` | ✔ | +| `getblockchaininfo` | ✔ | +| `getblockcount` | ✔ | +| `getblockhash` | ✔ | +| `getblockheader` | ✔ | +| `getblockstats` | ✔ | +| `getchaintips` | ✔ | +| `getdifficulty` | ✔ | +| `getmempoolinfo` | ✔ | +| `getnetworkhashps` | ✔ | + +### Mining + +| Method | Supported? | +|------------|:----------------:| +| `getmininginfo` | ✔ | + +### Network + +| Method | Supported? | +|------------|:----------------:| +| `getconnectioncount` | ✔ | +| `getnetworkinfo` | ✔ | + +### Raw transactions + +| Method | Supported? | +|------------|:----------------:| +| `getrawtransaction` | ✔ | + +## Usage +Minimal illustration (assuming Python 3.8+, where you can run `async` code in console) + +``` +$ python -m asyncio +>>> import asyncio +>>> +>>> from bitcoinrpc import BitcoinRPC +>>> rpc = BitcoinRPC("http://localhost:18443" "rpc_user", "rpc_passwd") +>>> await rpc.getconnectioncount() +10 +>>> await rpc.aclose() # Clean-up resource +``` + +You can also use the `BitcoinRPC` as an asynchronous context manager, which does +all the resource clean-up automatically, as the following example shows: + +``` +$ cat btc_rpc_minimal.py +import asyncio + +from bitcoinrpc import BitcoinRPC + + +async def main(): + async with BitcoinRPC("http://localhost:18443", "rpc_user", "rpc_password") as rpc: + print(await rpc.getconnectioncount()) + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +Running this script yields: +``` +$ python btc_rpc_minimal.py +10 +``` + +## Changelog + +- **2021/12/28 - 0.5.0** change the signature of `BitcoinRPC` from `host, port, ...` to `url, ...`, delegating the creation of the node url to the caller. + + +## License +MIT + + + + +%package help +Summary: Development documents and examples for bitcoinrpc +Provides: python3-bitcoinrpc-doc +%description help +# bitcoin-python-async-rpc +Lightweight Bitcoin async JSON-RPC Python client. + +Serves as a tiny layer between an application and a Bitcoin daemon, its primary usage +is querying the current state of Bitcoin blockchain, network stats, transactions... + +If you want complete Bitcoin experience in Python, consult +[python-bitcoinlib](https://github.com/petertodd/python-bitcoinlib). + +## Installation +```bash +$ pip install bitcoinrpc +``` + +## Supported methods +Here is a list of supported methods, divided by their categories. Should you need +method not implemented, wrap the call in `BitcoinRPC.acall(<your_method>, ...)` coroutine. + +### Blockchain + +| Method | Supported? | +|------------|:----------------:| +| `getbestblockhash` | ✔ | +| `getblock` | ✔ | +| `getblockchaininfo` | ✔ | +| `getblockcount` | ✔ | +| `getblockhash` | ✔ | +| `getblockheader` | ✔ | +| `getblockstats` | ✔ | +| `getchaintips` | ✔ | +| `getdifficulty` | ✔ | +| `getmempoolinfo` | ✔ | +| `getnetworkhashps` | ✔ | + +### Mining + +| Method | Supported? | +|------------|:----------------:| +| `getmininginfo` | ✔ | + +### Network + +| Method | Supported? | +|------------|:----------------:| +| `getconnectioncount` | ✔ | +| `getnetworkinfo` | ✔ | + +### Raw transactions + +| Method | Supported? | +|------------|:----------------:| +| `getrawtransaction` | ✔ | + +## Usage +Minimal illustration (assuming Python 3.8+, where you can run `async` code in console) + +``` +$ python -m asyncio +>>> import asyncio +>>> +>>> from bitcoinrpc import BitcoinRPC +>>> rpc = BitcoinRPC("http://localhost:18443" "rpc_user", "rpc_passwd") +>>> await rpc.getconnectioncount() +10 +>>> await rpc.aclose() # Clean-up resource +``` + +You can also use the `BitcoinRPC` as an asynchronous context manager, which does +all the resource clean-up automatically, as the following example shows: + +``` +$ cat btc_rpc_minimal.py +import asyncio + +from bitcoinrpc import BitcoinRPC + + +async def main(): + async with BitcoinRPC("http://localhost:18443", "rpc_user", "rpc_password") as rpc: + print(await rpc.getconnectioncount()) + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +Running this script yields: +``` +$ python btc_rpc_minimal.py +10 +``` + +## Changelog + +- **2021/12/28 - 0.5.0** change the signature of `BitcoinRPC` from `host, port, ...` to `url, ...`, delegating the creation of the node url to the caller. + + +## License +MIT + + + + +%prep +%autosetup -n bitcoinrpc-0.5.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-bitcoinrpc -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.0-1 +- Package Spec generated @@ -0,0 +1 @@ +fe3616d54b24b62efca38844b5b9b5cd bitcoinrpc-0.5.0.tar.gz |
