Bitcoin Forum
May 27, 2024, 05:34:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [31] 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 »
601  Bitcoin / Development & Technical Discussion / Re: Lightning Network on: January 28, 2018, 01:38:58 AM
by creating the Lightning Network. it.s dependent upon the underlying technology of the blockchain. By using real Bitcoin/blockchain transactions and using its native smart-contract scripting language, it is possible to create a secure network of participants which are able to transact at high volume and high speed.

They can talk all they want about "smart contracts" instead of private ledgers but on ETH these smart contracts are uploaded
by developers who want to deploy bean counting software and this is absolutely nothing like that and they are playing with
words just like they are in Lightning by trying to refuse to call hubs banks.

Here take a look and tell me that this is mama and poppa banking
https://lnmainnet.gaben.win/

Your starting to scarring me so lets skin a "Smart contract" out

Both sides deposit money
Move $25 from Bob to banks side of ledger (Joining fee)
Make Bob sign the muiltisig transaction
if (Direction=Outbound) Tx fee+= $0.10
else Interest Fee +=1% of amount
Make Bob sign the muiltisig transaction
//Bob can leave at any time but will pay us in the other hand in BTC block-chain fees


Anyone can be a banking hub if they know how to write "Smart Contracts" from a wallet and deploy the contract
on BTC mining nodes


602  Economy / Exchanges / Re: Coincheck robbed of $500m coins so is the protocol to blame on: January 28, 2018, 01:09:37 AM
Cmon, you not saying the WannaCry virus is coming from the Bitcoin client? This client has been used by 1000s of people and

nobody complained about this happening to them. You do not have to smack talk Bitcoin in preparation for what you are

creating... build your own coin and hope you get enough people to support it. Bad mouthing other people's work, will not

gain you any credibility with Bitcoin supporters.  Angry

Given my description then where would you say I picked it up from and yes "1000s of people"
got infected but not just via Tor client software but I believe this was the culprit with me so yes I was like you
once when people started talking about the CIA owning some of the exit nodes so save your
"Bad mouthing" garbage because I have a duty to warn people and won't be making money
from the deal unlike you would like to make if you want to talk about "credibility".

Mr "green crypto mining ICO" just how can CPU-Wars between miners ever be considered green
because your not getting any supporters on that one apart from Miners, Intel and AMD along with
big oil and you dare talk to me about "credibility" around here.

603  Bitcoin / Development & Technical Discussion / Re: How to start bitcoin development on: January 28, 2018, 01:02:44 AM
You should Join ICOs. They are very profitable to invest in and can also join Faucets to start earning bitcoins.

So what's your ICO selling ? Let me guess a new coin for save the Indian Tiger and your spamming here so you
can get enough points to get one of them free adverts in the footer of you posts.
604  Bitcoin / Development & Technical Discussion / Re: How to start bitcoin development on: January 28, 2018, 12:54:20 AM
Well, just because a project is "Open Source" does not mean that it is obligated to accept any input.  The input should follow the original goal of the community.

Yes the goal of the miners and banking community must always come first and the goals of the original team and white paper
have all been forgotten.

Can the none mining "community" please take a vote on this one line of code ?
public static money MaxFee=1.5 // Miners that do not like it are free to leave because we have ten times more than we need

Here take a look at this map of channels on the Lightning Network (LN)
https://lnmainnet.gaben.win/
Hubs in LN charge fees and interest on money loaned out in bi-directional channel so that big banking hub
in the center in the diagram is not Bob mother and is a bank making profit and bankers are the only ones with any voting
rights in this "community"






605  Economy / Speculation / Re: When will the market rise? on: January 28, 2018, 12:43:38 AM
I think the cryptocurrency depression is coming to an end. Coins should start exploding in February again, this drop made possible for a lot of new capital to come in.

Wot new capital or did you not think that Joe six pack knows about fees and that we were forced to pay
as much as $55 for a digital transaction that's slow and other can do for less than a cent

I think Coins should start exploding crashing in February and I present a fact for my argument
plus people now know that the Lightning Network is all about central banking hubs but here is a
map of the network if you dare check it out.

https://lnmainnet.gaben.win/



606  Economy / Speculation / Re: When will the market rise? on: January 28, 2018, 12:38:24 AM
"When will the market rise?"

That's a leading question and it's true that Tulips had good and bad weeks until one day the price hit the
floor but if you want more modern day examples that are digital then cast your mind back to 2000 and
the Dot.CON crash.

Fees may well have killed Bitcoin and "trust" with the development team might never recover but I am
sure some gambling addicts will hang on to the end

607  Bitcoin / Development & Technical Discussion / Re: c-lightning on testnet: problems and questions on: January 28, 2018, 12:31:16 AM
Cdecker, does c-lightning only for testing but for work(planning to do an exchange) I go to install a Lightning Network Daemon (lnd) - ?

Here is a map of the LN network and it's not Bob connecting to Peter to send money to Alice and as you can see contains major hubs that
charge both interest if you have a bi-directional channel open and LN tx fees too.

https://lnmainnet.gaben.win/

Your always free not to use it and pay BTC miners $20 per transaction instead if you don't like bankers but the
thing is it will be the miners running these banking hubs on LN anyway so they have you by the balls and anyway
I like my data "On-Chain" and paying $0.10 per transaction without no up front fees to banks just like it was with
Bitcoin about a year ago.

Banking hubs are not an option in LN because if everyone paid for two channels to create a disbursed network then
it would take 50,000 hops to cross the network so that's not going to work but it's what they were trying to lead
people to believe.   



608  Bitcoin / Development & Technical Discussion / Re: Question: Hashgraph on: January 28, 2018, 12:17:49 AM
Yeah... closed source is game-ender for something that seeks widespread adoption concurrent with Bitcoin. It can either be closed source supported by entity like Apple or Microsoft or open-source.

Fees on Bitcoin has been a game changer and "Of Block" in LN is another one given that others can support a public ledger and also scale.

Open source does not mean you can have your say because i tried that one with Firefox developers with all the google back doors
in the code and project leader Mr J Poon for Lightning won't even answer emails or pass the message on so another developer can
deal with it.

Here is my contribution to Bitcoin "Open Source" Software but i am sure it will create a bug  Cheesy

public static money MaxFee=1.50// Too many miners (20,000) competing with each other, time some of them left, we only need 1,000 at most
609  Bitcoin / Development & Technical Discussion / Re: Question: Hashgraph on: January 28, 2018, 12:06:49 AM
EOS and Cardano  scale into hundreds of thousands per second. IOTA is just "slow at 100tps" because it scales with the size of the network, which isn't big now. But should IOTA make good on their promises and become the payment system for all things IOT, we would easily see millions of transactions per second.  (I think Cardano also falls into that category)

Nice to meet people who are not just playing the slot machine but I admit I am bias towards NEO because it's windows based
I thinks and trying to convert between data types used in Bitcoin that is more Linux based is a pain the bum and us poor windows
developers end up having to jump though windows backwards to get things to work or use mega big wrappers around C++
code to work.

610  Bitcoin / Development & Technical Discussion / Re: Guidance: Implementing a private and custom blockchain solution for supply chain on: January 27, 2018, 11:59:04 PM
Sorry for an offtopic question, but I can't help myself but ask why would big established business that is no stranger to digital tech want to use blockchain where it can use SQL (or other DB) for same purpose (tracking).

You beat me to it but it's the latest buzz word just like "On-Block" was but that's been replaced with "Off-Block" these days
but i can assure you all my apps are "User Friendly" and soon everyone of them will contain "A.I" even if i really understand
naff all about programming it.
611  Bitcoin / Development & Technical Discussion / Re: Lightning network - fast and low fees on: January 27, 2018, 11:53:40 PM
Do you have any evidence to support any of this conjecture

Sure pleanty so would you like the LN white paper https://lightning.network/lightning-network-paper.pdf
or the network map as it is running now https://lnmainnet.gaben.win/
or maybe you want to watch it on youtube https://www.youtube.com/watch?v=UYHFrf5ci_g
but if you want the noddy Bob and Alice version then here it is https://www.youtube.com/watch?v=rrr_zPmEiME

Quote
"And why do you keep saying "bank"?  No one is forcing you to transact with banks.  You can open a channel with anyone you like.  Or you can still send funds the conventional way.  From my understanding, it's entirely your preference if you want to "hop" through a number of people to reach someone or just deal directly with the person you want to deal with.  It's just that if you both already have "Lightning-ready" funds locked on the blockchain, it may well prove to be cheaper to go through the other people than is it to lock yet more funds on layer 0 to send directly.

if you want to live off grid then you don't need banking but for the rest of us we do and what we are seeing with LN is
ye old problem-reaction-solution and fees that have already gone sky high so you don't need a big IQ to work out where
we are going.

Quote
Long story short, go with whichever option is most cost effective.  But the simple fact is, you have options.  No one is putting a gun to your head and forcing you to do anything you don't want to do.

Sure felt like "gun to your head" last month when the miners here got $120 from me or did you not know that fees were like $0.10 a year ago and
peeked at $55 per transaction.
612  Other / Meta / Re: Where is the home discussion of Lightning Network on: January 27, 2018, 11:37:14 PM
Apparently some people reported loss of funds. Im not surprised to find out about this since the developers have warned about how the software is still in very early versions but I didn't see this mentioned here I think, and I didn't see this on reddit as far as I can find.

It is a complicated beast and could well be different to whats in the LN white-paper because programming is
reiterative which often leads to changes and I was told it would be 6-9 months before we see anything but then
I hear it was released very quietly.

Fact is the development team is not talking to the public and just doing as they please but I won't hold the
odd bugs against them too much, it happens now and then but it's how they resolve it that counts.
613  Bitcoin / Development & Technical Discussion / Re: What are the fees on the Lightning network? on: January 27, 2018, 11:30:27 PM
As far as i know, you only can charged fees when use LN on these conditions :
1. Open new LN channel.
2. Close LN channel.
3. Refill your balance.
4. Using hops which charge small fees when you don't have direct connection to receiver, but you don't have to use hops which charge fees.

If on-chain fees can be reduced and you don't use hops which charge fees, fees when using LN should be extremely reduced. CMIIW.

See https://lnmainnet.gaben.win/
I make it about six to eiht hops so that's five times "charge small fees" plus the first hub in bi-directional channel need to deposit
the banks money in the channel so that's going to amount to interest even if you don't use the channel it's still on loan to you
for incoming payments.

You cannot reach across the world to send money without using banking hubs in one off payments but you could open one with you mum on the
other side of the world, keep it open and keep sending each other money a millions times and call it almost free but in the
real world that's not how things works.

Open the LN white paper and search for the word "Fee" to see it's written all over the document and whats more none of the
fees are capped so in the end you are at the mercy of the bankers and we are talking about the same people that currently run mining
and charge you $20 just to store 250 bytes of data and take all day just to do that.
614  Bitcoin / Development & Technical Discussion / Re: What are the fees on the Lightning network? on: January 27, 2018, 11:13:30 PM
    There are no banks, (at least not yet).  Therefore, there are no "inter bank transfers".

    Well if you want to pretend that someone with 50 channels open acting as a major hub is not acting as a bank then that's up to you
    but this picture says that you could be wrong.

    https://lnmainnet.gaben.win/

    Quote
    • When you say "in the ledger connecting Bob", I assume you are talking about a Lightning Network channel?

    Yes the channel is the ledger with deposits in it from both the user (who could also become a banking hub, inter bank transfer) and the banking hub in LN

    Quote
    • When you say "to the banking hub", I assume you mean to imply that Bob has chosen to only open a channel to ONE other Lightning Network user, and the user that Bob has established a channel with has chosen to connect to open channels with many other users?

    Yes see the link, Bob only like one channel open, these things cost you know

    Quote
    • When you say "requires the bank to deposit $100 in it", I assume you mean that the ONE channel that Bob opened is funded with $100 worth of bitcoins by the person Bob chose to connect to?

    Yes one channel and not connected to a "person" who has 50 channels, it's a banking hub and needs a ton of money to feed all
    them other channel deposits. Miners have the money and hardware so they are the natural bankers running the banking hubs.

    Quote
    • When you say "Alice on the far side of the network", I assume you mean that Alice is a Lightning Network user, that she has at least one channel open, that there is a valid funded route for sending $100 worth of Bitcoins from her to Bob?

    Yes and she is connected also with one channel to a banking hub.

    Quote
    • When you say "if she wants to send him $200 then it would not be allowed because money cannot be moved from ledger to ledger", I assume you mean that Alice can't send more to Bob than the net funds available in the channel that is connected to Bob?

    Correct

    • When you say "because the BTC-Block chain only allows the existing money to be settled on block", I assume you mean that funds in one Lightning Network Channel cannot move to another channel, and that users with an unbalanced channel might in some circumstances need to close the channel and use the funds from the closed channel to re-open a new channel?

    Channel is the ledger with both ends keeping a copy but the key point shown in bold above. Money is not liquid in LN and is more like snooker balls
    bumping into one another and money stays in the ledger. See white paper https://lightning.network/lightning-network-paper.pdf
    Quote
    There are no banks (yet).  There may never be banks.

    Yes sure mate so what do you call something that charges fees on both lending and transactions fees and loves people so much
    that they open 50 channels. Sorry you can keep repeating yourself but the links I gave you prove otherwise.

    Quote
    Regardless the process works the same, so lets substitute Charlie in for the user that you keep calling "Bank".  It will make it clearer. Sicne you insist on using $ amounts instead of BTC amounts, we'll also assume that the exchange rate between $ and BTC doesn't change at all during that time.

    Well if it looks, talks and walks like a bank then lets call "Charlie" Natwest bank in central Cambridge and I am sorry about
    not using 0.00001000 BTC but I think we can live with it for now.

    Bob opens a channel (Lets call it channel B-C) with Charlie.
    No lets call it "Natwest bank in central Cambridge"
    Quote
    Bob funds the channel with $100 worth of bitcoins, and Charlie funds the channel with $100 worth of bitcoins.

    OK

    Quote
    Alice opens a channel with Charlie (Lets call it channel A-C) with Charlie.
    Alice funds the channel with $200 worth of bitcoins, and Charlie funds the channel with $0 worth of bitcoins.
    Alice establishes a route through Charlie to Bob and sends $100 worth of bitcoins

    After that:
    The A-C channel state has $100 worth of bitcoins that Charlie can send through the channel to Alice and $100 worth of bitcoins that Alice can send to Charlie.
    The B-C channel state has $200 worth of bitcoins that Bob can send through the channel to Charlie and $0 worth of bitcoins that Charlie can send to Bob.

    Yes if Natwest bank only deposits $100 then the channel is too small for Bob to receive $200 from Alice

    Quote
    If that is the ENTIRE network, then you are correct that no one can send him any money through Lightning Network (although they could still send a non-Lightning Bitcoin transaction if they want to.  However, it is possible that Bob could already have (or could open) other channels with other users, or Bob could open a new channel with Charlie.

    Yes but why should Bob keep paying the BTC miners money ?

    Quote
    Why do they need buttons?  Can't they just use wallets that can establish a lightning channel?

    Never seen a software wallet yet that does not have buttons have you but in the case of Lightning you
    will need more than the usual few buttons to act as a banking hub so the banks will have specialist software.

    Quote
    Why won't Bob and Alice have access to similar software?

    Well Jaxx and Exodus won't implement all that in the wallets and Bob would not understand things like
    HTLC or how to maximize profits by acting as a bank even if he could share his wallet to become a hub
    so his friend Alice could use it.

    Quote
    When you say "miners" I assume you mean "Mining pool operators"?  Because most of the hashers that I've talked to most certainly do NOT "understand the nuts and bolts".

    Just swap the name "Miner" for "Sub-Branch" and see "Mining pool operators" as "Nat west head office" and you about get the picture.

    Quote
    I don't think the word "Monopoly" means what you seem to think it means.
    Cartel is just as good to me

    Quote
    I'm having a difficult time following what you are trying to say there. I have an account with my local Credit Union.  I have an pleasantly low interest rate on my mortgage and car loan, and I don't pay any other fees for any of the services that I use.  There are services that have fees, but I don't use any of those services.

    Nice for you but I also bank with Ripple, all transactions are on-block and more or less free just like Bitcoin was before
    it was taken over.

    Quote
    I've seen you use this "Virtually free transactions fees" statement multiple times now.

    Then don't fall for it again.

    Quote
    I've checked the whitepaper and I don't see that statement in there at all.  Can you please tell me where to find it, or did you just make that up so you can sound angry about something that doesn't exist?

    Not in the LN white paper but original Bitcoin white-paper
    Quote
    Who is this "them" that you speak of?  The bitcoin white paper was written by Satoshi Nakamoto.  He was not involved in the creation of Lightning Network at all.

    Them is the development team who roll over backs to please the miners and in many cases run mining themselves and it is the same
    "Them" that own BTC from day one and it only cost "them" $0.15 per coin but we can agree that Satoshi Nakamoto was not involved in LN  

    615  Bitcoin / Development & Technical Discussion / Re: What are the fees on the Lightning network? on: January 27, 2018, 08:37:42 PM
    before the interface reports the "cheapest" route to the user. <favouring the channels that they hosted> Do you agree?

    it almost feels like me and you are starting to get along better together if you keep talking like that  Cheesy

    I think your saying that people will hold say three channel open with banker hubs and the wallet will workout
    who's going to be the cheapest which might not always be the shortest ?

    looking at this I think that the average hop count will be 6-8 hops https://lnmainnet.gaben.win/ but they are not
    fixed because for instance some ledgers will need liquidity moving from right to left and will actually offer negative
    transaction fees (Pay you to use them) which you can read about in the white pages so I think it will be very much a
    finger in the air type number myself when it comes to fees and interest on the banks money  

    Maybe we need official base rates and then banking hubs can offer X over base and a fixed fee per transaction
    but if the wallets interface becomes over complicated then Jaxx , Exodus and others will not write the code to
    make all this work so then shapeshift becomes trouble which would all be bad news for our slot-machine friends

    Shit banking hubs will become ranked by users, like it or not based on the IP address or wallet address so maybe they should
    build that into the system so that when you are shopping for a bank you can read the terms and conditions so we all
    know where we stand.

     
    616  Bitcoin / Development & Technical Discussion / Re: Proof of Stake Bitcoin? on: January 27, 2018, 07:16:34 PM
    The real opposing force would be miners, true. They have invested over a few million bucks to rake in huge amount of profits every day just to let it go that easily. Besides, switching over to PoS means that consensus wise, people who have the fatter wallets would have the most voice over a certain issue/development that the coin might face in the future.

    I cannot stand PoW and you raise a good point and I am working on something were server-side wallets become distributed across several
    nodes and was kind of thinking about making the "Miners" or wallet nodes bid to host wallets using gas and then getting a fine paid in "Gas" if they
    did not deliver the goods, time out, cheat or attack other nodes.

    into the mix I might even throw a small sprinkling of this new thing called "trust" where nodes with good up times and good speeds are
    invited to become members of the coordinators team so a human can be contacted within the network anonymously without taking control
    and maybe I will give users a say in whats happening by allowing them to vote and not just reserving this privilege for "Miners"

    Yes "power to the people" without fat cats and miners taking over.
    617  Bitcoin / Development & Technical Discussion / Re: Scaling bitcoin: the elephant in the room on: January 27, 2018, 06:51:34 PM
    consensus, than an inherent problem of finding consensus.

    When Bitcoin was being developed on a university campus by academia it worked fine but now
    we know that it won't scale and consensus might work on a dozen or so machines but now we
    have 20,000 machines doing the "consensus" which leads to a lot of wasted effort

    The internet runs on an array of specialized nodes providing specific services and the Bitcoin "Every node for himself"
    philosophy is a disaster but then the Lightning Network goes the other way when it comes to off-block private ledgers
    running on banking hubs so we end up with a single point of failure unless paying miners Tx fees to open up lots of
    channel for our wallets.

    Come on boys we had web-farms providing redundancy on the internet twenty years ago to spread the
    load because it's starting to look to me like bitcoin is designed just to keep the miners happy and yes someone
    needs paying to provide hosting services but lets start thinking about the public when it comes to design and
    put the miners more to the back of the queue.

    CPU-Wars and PoW to make a living, i don't know what they will think of next
    618  Other / Meta / Re: Where is the home discussion of Lightning Network on: January 27, 2018, 06:30:04 PM
    This developer section seems fine for me or else it's gets hidden away in one of the many sub-forums
    here that few people get to read.

    FUD seems to be a word used when someone does not agree with the decisions of the Bitcoin development
    team here but i say if the cap fits let the fudge it if the argument is backed up with facts and logic
    619  Bitcoin / Development & Technical Discussion / Re: C# code needed for public-private Bitcoin addresses on: January 27, 2018, 06:21:33 PM
    Well I managed to get something working without using the usual mega big 3rd party solutions if anyone is interested
    that works in C# using an extension class that wraps dot.nets RSACryptoServiceProvider

    Sample usage tested and shown belew

    Code:
    string secret = "My secret message";
    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(512);  // Key bits length
    byte[] secretData = Encoding.UTF8.GetBytes(secret);
    //Microsoft RSA byt default will encode with public key and decode with the private key
    byte[] encPublic = rsa.PublicEncryption(secretData);
    byte[] decPublic = rsa.PublicDecryption(encPublic);
    //Now we can also encode with public key and decode with the private keys needed for signatures
    byte[] encPrivate = rsa.PrivateEncryption(secretData);
    byte[] decPrivate = rsa.PrivateDecryption(encPrivate);
    //Just test we got the original data back
    string MsgPublic = Encoding.UTF8.GetString(decPublic);  
    string MsgPrivate = Encoding.UTF8.GetString(decPrivate);  

    Complete listing shown below so just add a class to your project and drop this code in the file and you
    should be good to go with most of the credit going to Dudi Bedner

    Code:
    //All credits go to Dudi Bedner at https://www.codeproject.com/Articles/38739/RSA-Private-Key-Encryption
    //This is an extension class and extends RSACryptoServiceProvider so that it will encryt/decrypt using both public and private keys
    using System;
    using System.Text;
    using System.Security.Cryptography;
    using System.Numerics;

    namespace RSAExtensions
    {
        public static class RSAPrivateEncryption
        {
            public static byte[] PublicEncryption(this RSACryptoServiceProvider rsa, byte[] data)
            {
                //rsa.FromXmlString(key);
                byte[] encryptedData = rsa.Encrypt(data, false);
                string base64Encrypted = Convert.ToBase64String(encryptedData);
                return UTF8Encoding.UTF8.GetBytes(base64Encrypted);
            }

            public static byte[] PublicDecryption(this RSACryptoServiceProvider rsa, byte[] cipherData)
            {
                //var resultBytes = Convert.FromBase64String(EncryptedStr);

                string Data = UTF8Encoding.UTF8.GetString(cipherData);
                var resultBytes = Convert.FromBase64String(Data);
                var decryptedBytes =rsa.Decrypt(resultBytes, false);
                string decryptedData = Encoding.UTF8.GetString(decryptedBytes);
                return UTF8Encoding.UTF8.GetBytes(decryptedData);
            }


            public static byte[] PrivateEncryption(this RSACryptoServiceProvider rsa, byte[] data)
            {
                if (data == null)
                    throw new ArgumentNullException("data");
                if (rsa.PublicOnly)
                    throw new InvalidOperationException("Private key is not loaded");

                int maxDataLength = (rsa.KeySize / 8) - 6;
                if (data.Length > maxDataLength)
                    throw new ArgumentOutOfRangeException("data", string.Format(
                        "Maximum data length for the current key size ({0} bits) is {1} bytes (current length: {2} bytes)",
                        rsa.KeySize, maxDataLength, data.Length));

                // Add 4 byte padding to the data, and convert to BigInteger struct
                BigInteger numData = GetBig(AddPadding(data));

                RSAParameters rsaParams = rsa.ExportParameters(true);
                BigInteger D = GetBig(rsaParams.D);
                BigInteger Modulus = GetBig(rsaParams.Modulus);
                BigInteger encData = BigInteger.ModPow(numData, D, Modulus);

                return encData.ToByteArray();
            }

            public static byte[] PrivateDecryption(this RSACryptoServiceProvider rsa, byte[] cipherData)
            {
                if (cipherData == null)
                    throw new ArgumentNullException("cipherData");

                BigInteger numEncData = new BigInteger(cipherData);

                RSAParameters rsaParams = rsa.ExportParameters(false);
                BigInteger Exponent = GetBig(rsaParams.Exponent);
                BigInteger Modulus = GetBig(rsaParams.Modulus);

                BigInteger decData = BigInteger.ModPow(numEncData, Exponent, Modulus);

                byte[] data = decData.ToByteArray();
                byte[] result = new byte[data.Length - 1];
                Array.Copy(data, result, result.Length);
                result = RemovePadding(result);

                Array.Reverse(result);
                return result;
            }

            private static BigInteger GetBig(byte[] data)
            {
                byte[] inArr = (byte[])data.Clone();
                Array.Reverse(inArr);  // Reverse the byte order
                byte[] final = new byte[inArr.Length + 1];  // Add an empty byte at the end, to simulate unsigned BigInteger (no negatives!)
                Array.Copy(inArr, final, inArr.Length);

                return new BigInteger(final);
            }

            // Add 4 byte random padding, first bit *Always On*
            private static byte[] AddPadding(byte[] data)
            {
                Random rnd = new Random();
                byte[] paddings = new byte[4];
                rnd.NextBytes(paddings);
                paddings[0] = (byte)(paddings[0] | 128);

                byte[] results = new byte[data.Length + 4];

                Array.Copy(paddings, results, 4);
                Array.Copy(data, 0, results, 4, data.Length);
                return results;
            }

            private static byte[] RemovePadding(byte[] data)
            {
                byte[] results = new byte[data.Length - 4];
                Array.Copy(data, results, results.Length);
                return results;
            }
        }
    }




    620  Bitcoin / Development & Technical Discussion / Re: C# code needed for public-private Bitcoin addresses on: January 27, 2018, 03:25:38 PM
    Microsoft is useless and I was just skinning some code out to do RSA encryption using this bit of code
    that should work on older versions of the DOT.NET framework that don't come with BigINT

    Code:
     RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(384);
    _privateKey = rsa.ToXmlString(true);
    _publicKey = rsa.ToXmlString(false);
    string text = "Hello world";
    string encPublic = EncodePublic(_publicKey, text);
    string decPrivate = DecodePrivate(_privateKey, encPublic);

    string encSig = EncodePublic(_privateKey, text);
    string decSigPrivate = DecodePrivate(_privateKey, encSig);
    string decSigPublic = DecodePrivate(_publicKey, encSig);  //GOES BANG HERE

    public string  EncodePublic(string key,string str)
            {
                RSACryptoServiceProvider RSA2= new RSACryptoServiceProvider();
                RSA2.FromXmlString(key);
                byte[] encryptedData = RSA2.Encrypt(Encoding.UTF8.GetBytes(str), false);
                string base64Encrypted = Convert.ToBase64String(encryptedData);
                return base64Encrypted;
            }

            public string DecodePrivate(string key, string EncryptedStr)
            {
                RSACryptoServiceProvider RSA2 = new RSACryptoServiceProvider();
                RSA2.FromXmlString(key);
                var resultBytes = Convert.FromBase64String(EncryptedStr);
                var decryptedBytes = RSA2.Decrypt(resultBytes, false);
                var decryptedData = Encoding.UTF8.GetString(decryptedBytes);
                return decryptedData;
            }

    I want to use the old framework because it will work on more clients but after hours of
    looking around i come across this
    Quote

    RSA Private Key Encryption

    Unfortunately, the RSACryptoServiceProvider class does not provide you this option, so I wrote my own implementation of the RSA algorithm using the basics of the RSACryptoServiceProvider in conjunction with Chew Keong TAN's class: BigInteger (http://www.codeproject.com/KB/cs/biginteger.aspx). At a low level, the RSA algorithm is about implementing mathematical equations on huge (huge) integers, so the BigInteger class is really essential. I couldn't have done it myself.

    So thanks Microsoft for not throwing an error like "Private key encryption is not possible" instead of "Key not found"
    from the bloated framework.

    I thought that I wanted private key encryption for the signature when signing transactions and Bitcoin uses this technique
    but then I started to read more about it and this guy says https://rdist.root.org/2007/05/03/rsa-public-keys-are-not-private-implementation/
    Quote
    Finally, I’d like to reiterate what I’ve said before. Public key cryptosystems and RSA in particular are extremely fragile. Do not use them differently than they were designed. Better yet, seek expert review or design assistance when working with any design involving crypto.

    What do you guys think ?
    Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [31] 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 »
    Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!