polve / bitcoin-rpc-client Goto Github PK
View Code? Open in Web Editor NEWJava Bitcoind RPC helper class
Java Bitcoind RPC helper class
The use of double leads to all sorts of rounding issues.
The network uses amounts with a fixed scale of 8
wf.bitcoin.javabitcoindrpcclient.BitcoinRPCException: RPC Query Failed (method: getblockcount, params: [], response code: 415 responseMessage Unsupported Media Type, response: invalid content type, only application/json is supported
Missing methods supported in 0.17.0 are ...
It is currently not possible to generate 'legacy' addresses through getNewAddress()
[ERROR] /Users/tdiesler/git/JavaBitcoindRpcClient/src/main/java/wf/bitcoin/javabitcoindrpcclient/BitcoinRPCException.java:23: error: malformed HTML
[ERROR] * <[email protected]>
[ERROR] ^
[ERROR] /Users/tdiesler/git/JavaBitcoindRpcClient/src/main/java/wf/bitcoin/javabitcoindrpcclient/BitcoinRPCException.java:23: error: bad use of '>'
[ERROR] * <[email protected]>
[ERROR] ^
[ERROR]
[ERROR] Command line was: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/../bin/javadoc @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in '/Users/tdiesler/git/JavaBitcoindRpcClient/target/apidocs' dir.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Missing methods supported in 0.17.0 are ...
[bob@Nessus-IPFS ~]$ docker exec btcd bitcoin-cli -testnet=1 getblockchaininfo
{
"chain": "test",
"blocks": 1444656,
"headers": 1444656,
"bestblockhash": "000000000000013e04a490ac3b9814e163d8a9c6a04858649f206043c273a150",
"difficulty": 12368745.01434309,
"mediantime": 1542895208,
"verificationprogress": 0.9999924124513836,
"initialblockdownload": false,
"chainwork": "0000000000000000000000000000000000000000000000d4be4d5f962630a176",
"size_on_disk": 957663921,
"pruned": true,
"pruneheight": 1412618,
"automatic_pruning": true,
"prune_target_size": 1073741824,
"softforks": [
{
"id": "bip34",
"version": 2,
"reject": {
"status": true
}
},
{
"id": "bip66",
"version": 3,
"reject": {
"status": true
}
},
{
"id": "bip65",
"version": 4,
"reject": {
"status": true
}
}
],
"bip9_softforks": {
"csv": {
"status": "active",
"startTime": 1456790400,
"timeout": 1493596800,
"since": 770112
},
"segwit": {
"status": "active",
"startTime": 1462060800,
"timeout": 1493596800,
"since": 834624
}
},
"warnings": "Warning: unknown new rules activated (versionbit 28)"
}
Getting Tx: 853e910bedb7c8213bc93cab7e8337e0a59731db1e0c8968d2e19355d850bdc5
Nov 29, 2018 6:44:36 AM wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient$TransactionWrapper raw
WARNING: RPC Query Failed (method: getrawtransaction, params: [853e910bedb7c8213bc93cab7e8337e0a59731db1e0c8968d2e19355d850bdc5, 1], response code: 500 responseMessage Internal Server Error, response: {"result":null,"error":{"code":-5,"message":"No information available about transaction"},"id":"1"}
Got Tx: [tx=853e910bedb7c8213bc93cab7e8337e0a59731db1e0c8968d2e19355d850bdc5, vin=0, vout=0]
May returns a Tx object that has neither vin nor vout
relates to #55
I am using bitcoin-rpc-client in conjunction with walletnotify to get transaction data upon first confirmation. The problem is that getTransaction
method returns Invalid Tx
because of the following error under the hood:
No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.
I can set txindex
, but it's redundant for me, as I am interested only in my wallet transactions, moreover AFAIU it will add some performance overhead.
I've found the source of the problem, but still can't understand the solution. Both getTransaction
and getRawTransaction
methods now do getrawtransaction
under the hood which is inconvenient when one works with his own wallet transactions only
could the method "fundRawTransaction" be added ?
When I try to move funds from one account to another, I get an exception that boolean cannot be converted to string. Checking the result map in loadResponse, it shows "result" -> "true".
Currently this requires ExtendedTxInput
Missing methods supported in 0.17.0 are ...
You shouldn't keep amount in double. I suggest long in satoshi (like in BitcoinJ) or BigDecimal.
This should be supported.
Code would go to an endless loop when get a big string. The stack are listed below
at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSHash(CrippledJavaScriptParser.java:156) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSExpr(CrippledJavaScriptParser.java:191) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSArray(CrippledJavaScriptParser.java:99) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSExpr(CrippledJavaScriptParser.java:189) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSHash(CrippledJavaScriptParser.java:146) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSExpr(CrippledJavaScriptParser.java:191) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSHash(CrippledJavaScriptParser.java:146) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSExpr(CrippledJavaScriptParser.java:191) at wf.bitcoin.krotjson.CrippledJavaScriptParser.parseJSExpr(CrippledJavaScriptParser.java:256) at wf.bitcoin.krotjson.JSON.parse(JSON.java:129) at wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient.loadResponse(BitcoinJSONRPCClient.java:187) at wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient.query(BitcoinJSONRPCClient.java:229) at wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient.getRawTransaction(BitcoinJSONRPCClient.java:1283)
It would occurs every time when getRawTransaction("b6299d23e836d649a5a5012ebfebd2474b4d100d5334d7608d3c6c01b8204b45")
Perhaps like this
JavaBitcoindRpcClient => java-bitcoin-client
The repo name on github may then also want to change.
PS: most jars have a lower case name with dashes
Can't compile on Mac or Linux because the two classes (BitcoinRpcExtension and BitcoinRPCException) have the same name, in the same package, but with different cases.
BitcoinRPCException should be renamed to avoid conflicts with BitcoinRpcException.
When i execute below code it create a account with this email: [email protected] .
BitcoinJSONRPCClient bitcoin = new BitcoinJSONRPCClient(url);
String address = bitcoin.getNewAddress("[email protected]");
when i execute bitcoin-cli listaccounts
in my terminal. I can see account created with my email but i can see some default balance in it . Here is the listaccounts output:
{
"": -0.55385912,
"[email protected]": 1.11942880,
}
I want when ever i call getNewAddress
method it should create account with 0 BTC balance
java.lang.NullPointerException
at java.math.BigDecimal.<init>(BigDecimal.java:806)
at wf.bitcoin.javabitcoindrpcclient.MapWrapper.mapBigDecimal(MapWrapper.java:74)
at wf.bitcoin.javabitcoindrpcclient.MapWrapper.mapBigDecimal(MapWrapper.java:60)
at wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient$SmartFeeResultMapWrapper.feeRate(BitcoinJSONRPCClient.java:925)
at io.nessus.bitcoin.BitcoinNetwork.estimateSmartFee(BitcoinNetwork.java:42)
at io.nessus.AbstractWallet.sendToAddress(AbstractWallet.java:246)
at io.nessus.AbstractWallet.sendFromLabel(AbstractWallet.java:235)
at io.nessus.test.bitcoin.RawTxTest.after(RawTxTest.java:62)
It may be useful to align the version of this project to the one of bitcoin core. In that way it would be immediately obvious what scope of functionality can be expected to be supported.
Missing methods supported in 0.17.0 are ...
Missing methods supported in 0.17.0 are ...
Can not find any way to create raw transaction which has data in it's output list.
in bitcoin command, data can insert as one of outputs. e.g.
{
"mgt9WNsoi7pPY29ACTuWPVX73XGFVhD9Vi": 40,
"data": "ba3885e9aa5fd0949f40dc5d7905700fa039ef8ad425c60479cc52dfe16aa3e8"
}
but here amount of TxOut in double and can not use as String data.
Sorry, can not find any better way to contact.
if i missed something and there is a way in JavaBitcoindRpcClient, guide me to that.
Missing methods supported in 0.17.0 are ...
getaccountaddress doesn't work, can you please add it thank you.
Also see PR #48
We have a few incompatible changes lined up in branch 0.17.x. Now that this version of bitcoin core has been released, it is time to bring them in to master.
The question however arises what the next version should be. I propose a semantic versioning scheme, where an incompatible API change would call for a major version bump.
The next version would therefore be 1.0.0
It is not generally true that the key/value map returned from the Bitcoin client contains a value for the requested pair. For example vout is not present for coinbase transactions. The API must therefore use Object equivalents of primitive types.
This is an incompatible change.
I'm having problems finding a java library that is easy to use to connect to the bitcoin core api. Finally found this, but I need the getBlockTemplate function. Are there any plans to implement it, or do I have to keep looking?
I think there is a typo in this function:
@OverRide
public String type() {
return mapStr(type()); <====== typo?
}
I think it should be:
return mapStr("type");
Please add move to the client, thank you.
Missing methods supported in 0.17.0 are ...
$ bitcoin-cli fundrawtransaction
error code: -1
error message:
fundrawtransaction "hexstring" ( options )
Add inputs to a transaction until it has enough in value to meet its out value.
This will not modify existing inputs, and will add one change output to the outputs.
Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.
The inputs added will not be signed, use signrawtransaction for that.
Note that all existing inputs must have their previous output transaction be in the wallet.
Note that all inputs selected must be of standard form and P2SH scripts must be
in the wallet using importaddress or addmultisigaddress (to calculate fees).
You can see whether this is the case by checking the "solvable" field in the listunspent output.
Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only
Arguments:
1. "hexstring" (string, required) The hex string of the raw transaction
2. options (object, optional)
{
"changeAddress" (string, optional, default pool address) The bitcoin address to receive the change
"changePosition" (numeric, optional, default random) The index of the change output
"includeWatching" (boolean, optional, default false) Also select inputs which are watch only
"lockUnspents" (boolean, optional, default false) Lock selected unspent outputs
"feeRate" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (BTC per KB)
}
for backward compatibility: passing in a true instead of an object will result in {"includeWatching":true}
Result:
{
"hex": "value", (string) The resulting raw transaction (hex-encoded string)
"fee": n, (numeric) Fee in BTC the resulting transaction pays
"changepos": n (numeric) The position of the added change output, or -1
}
"hex"
Examples:
Create a transaction with no inputs
> bitcoin-cli createrawtransaction "[]" "{\"myaddress\":0.01}"
Add sufficient unsigned inputs to meet the output value
> bitcoin-cli fundrawtransaction "rawtransactionhex"
Sign the transaction
> bitcoin-cli signrawtransaction "fundedtransactionhex"
Send the transaction
> bitcoin-cli sendrawtransaction "signedtransactionhex"
getinfo doesn't work, can you please add it thank you.
Since bitcoin/bitcoin#12953 i wish have to work with new commands. but there is a way to do that in your client ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.