Author

Topic: I'm here to help you guys Please pass queries regarding Java and Web Development (Read 641 times)

hero member
Activity: 644
Merit: 500
Hey can you compile a Java based wallet for Bitcoin and what code will you use in it? can you give  a sample of a module like the java code for connecting wallet to blockchain.

Best Regards

Yup we can do through the concept bitcoinj, and you can acheive in wallet connect as well as you can trace the wallet's transactions too.

Please find it...

import java.math.BigInteger;

import com.google.bitcoin.core.*;
import com.google.bitcoin.core.Wallet.SendRequest;
import com.google.bitcoin.params.UnitTestParams;
import com.google.bitcoin.store.*;
import com.google.bitcoin.utils.TestUtils;

public class MyProgram {
   
   public static void main(String[] args) throws Exception {
        Wallet wallet = new FakeWallet();
       
        System.out.println("Your wallet:\n"+wallet);
      
        ECKey toDestination = new ECKey();
        Address destination = toDestination.toAddress(wallet.getNetworkParameters());
        //You could also create an address like this in prod (but not here in test):
       //Address destination = new Address(wallet.getNetworkParameters(), "1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T");
       
      SendRequest request = SendRequest.to(destination, BigInteger.valueOf(2000L));
      
      //Here are some examples that could change the transaction fee
      Wallet.SendRequest.DEFAULT_FEE_PER_KB = BigInteger.ZERO;
      request.ensureMinRequiredFee = false;
      request.fee = BigInteger.ZERO;
      request.feePerKb = BigInteger.ZERO;
      
      //Create the transaction
      Transaction transaction = wallet.sendCoinsOffline(request);
      
      System.out.println("The transaction:\n"+transaction);
   }
   
   static class FakeWallet extends Wallet {
      //A fake wallet that does not run on the real bitcoin network
      static NetworkParameters params = UnitTestParams.get();
      private static final long serialVersionUID = 1L;
      private ECKey myKey;
       private Address myAddress;
      private BlockStore blockStore;
      public FakeWallet() throws Exception {
         super(params);
         myKey = new ECKey();
           myAddress = myKey.toAddress(params);
           addKey(myKey);
           blockStore = new MemoryBlockStore(params);
           receiveFakeCoins(blockStore, BigInteger.valueOf(100000000), this, myAddress);
           //You could also create a blockchain = new BlockChain(params, wallet, blockStore);
      }
      public static void receiveFakeCoins(BlockStore blockStore, BigInteger amount, Wallet wallet, Address toAddress) throws Exception {
         Transaction tx = TestUtils.createFakeTx(wallet.getNetworkParameters(), amount, toAddress);
         TestUtils.BlockPair bp = TestUtils.createFakeBlock(blockStore, tx);
         wallet.receiveFromBlock(tx, bp.storedBlock, AbstractBlockChain.NewBlockType.BEST_CHAIN, 0);
         wallet.notifyNewBestBlock(bp.storedBlock);
      }
   }
}


This I created with fake Btc address and with fake details. But this is the coding format and functions for Wallet transaction and wallet connection In Java platform medium.
hero member
Activity: 686
Merit: 500
Hey can you compile a Java based wallet for Bitcoin and what code will you use in it? can you give  a sample of a module like the java code for connecting wallet to blockchain.

Best Regards
hero member
Activity: 644
Merit: 500
My question: What is the best way to use python code inside Java code (more specifically, Android)?, a colleague is working on an app that should use GNU Radio library (which works with both c++ and python) and we would like to evaluate alternatives (there is already an Android version of GNU Radio, but it seems a bit incomplete).

Hi since you're offering the service I would like to ask a question I have been breaking my head for hours .
How can I parse json data and represent the objects in from of a list style using JavaScript ?
Quote from: OP
I'm here to help you guys Please pass queries regarding Java and Web Development
@Pat: You should first understand the difference between Java and Javascript.

"...regarding Java and Web Development", it is possible to argue about the meaning of the title. The OP could have meant either "Web Development in Java" or "Java and Web Development in general" (some people would recommend using an Oxford Comma if you wanted the second meaning, but, as far as I know, it is not mandatory, so either could be).
2 to 3 ways we have dude. previously in older version java we used some steps but nowadays in jython, normally people use to develop android platform using in SL4A

import android
droid = android.Android()
result = droid.makeToast('Hello, world!')

In every file used have have import file android.py python
Try this dude if this not fine for also let me know dude
hero member
Activity: 644
Merit: 500
Hi since you're offering the service I would like to ask a question I have been breaking my head for hours .
How can I parse json data and represent the objects in from of a list style using JavaScript ?
Quote from: OP
I'm here to help you guys Please pass queries regarding Java and Web Development
@Pat: You should first understand the difference between Java and Javascript.
The OP doesn't seem to have any problems with the question. In fact he appreciated it and answered .Which part of this post you are contributing to rather than critising my knowledge of java and JavaScript's ?Sure I would appreciate your post had it been imparting quality suggestions or knowledge .If you have to say something make it look productive or stop spamming the threads as you're doing in your previous posts .

Cool Bro... Take it easy, Have you understood the example which I gave Is it fine for your clarification? If not means please let me know dude. I ll try to help you as much I can.
legendary
Activity: 1750
Merit: 1115
Providing AI/ChatGpt Services - PM!
Hi since you're offering the service I would like to ask a question I have been breaking my head for hours .
How can I parse json data and represent the objects in from of a list style using JavaScript ?
Quote from: OP
I'm here to help you guys Please pass queries regarding Java and Web Development
@Pat: You should first understand the difference between Java and Javascript.
The OP doesn't seem to have any problems with the question. In fact he appreciated it and answered .Which part of this post you are contributing to rather than critising my knowledge of java and JavaScript's ?Sure I would appreciate your post had it been imparting quality suggestions or knowledge .If you have to say something make it look productive or stop spamming the threads as you're doing in your previous posts .
sr. member
Activity: 337
Merit: 250
HTML5/Node.js/PHP developer
Hi since you're offering the service I would like to ask a question I have been breaking my head for hours .
How can I parse json data and represent the objects in from of a list style using JavaScript ?
Quote from: OP
I'm here to help you guys Please pass queries regarding Java and Web Development
@Pat: You should first understand the difference between Java and Javascript.
hero member
Activity: 644
Merit: 500
Hi since you're offering the service I would like to ask a question I have been breaking my head for hours .
How can I parse json data and represent the objects in from of a list style using JavaScript ? The json file is on a remote server and I'm using $http method to call the file ,I'm able to parse the data but not able to re present in the list style .

Just I am giving example for you.

var obj=jQuery.parseJSON( '{ "name": "avw1982" }' );
alert( obj.name === "avw1982");

JSON standard does not permit control characters such as tab or newline...
legendary
Activity: 1750
Merit: 1115
Providing AI/ChatGpt Services - PM!
Hi since you're offering the service I would like to ask a question I have been breaking my head for hours .
How can I parse json data and represent the objects in from of a list style using JavaScript ? The json file is on a remote server and I'm using $http method to call the file ,I'm able to parse the data but not able to re present in the list style .
hero member
Activity: 644
Merit: 500
I am here to help you, Ask your questions freely and we will discuss about it. from basic to expert level!!!
Jump to: