• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Reply to: Blockchain

Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Blockchain"

Collapse

  • Jog On
    replied
    Originally posted by SunnyInHades View Post
    /*
    Simple blockchain using a CUKC - Contractor UK coin. Just like parts of Ethereum, written in the 'C like' Go language
    Code taken from Aug 2017 Ivan Kuznetsov article at https://jeiwan.cc/posts/building-blo...-in-go-part-1/
    To easily test copy'n'paste everything into the top part of the yellow 'Try Go' box at https://golang.org and press 'Run'
    */

    package main

    import (
    "bytes"
    "crypto/sha256"
    "strconv"
    "time"
    )

    import (
    "fmt"
    )

    type Block struct {
    Timestamp int64
    Data []byte
    PrevBlockHash []byte
    Hash []byte
    }

    type Blockchain struct {
    blocks []*Block
    }

    func (b *Block) SetHash() {
    timestamp := []byte(strconv.FormatInt(b.Timestamp, 10))
    headers := bytes.Join([][]byte{b.PrevBlockHash, b.Data, timestamp}, []byte{})
    hash := sha256.Sum256(headers)
    b.Hash = hash[:]
    }

    func NewBlock(data string, prevBlockHash []byte) *Block {
    block := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}}
    block.SetHash()
    return block
    }

    func NewGenesisBlock() *Block {
    return NewBlock("Genesis Block", []byte{})
    }

    func (bc *Blockchain) AddBlock(data string) {
    prevBlock := bc.blocks[len(bc.blocks)-1]
    newBlock := NewBlock(data, prevBlock.Hash)
    bc.blocks = append(bc.blocks, newBlock)
    }

    func NewBlockchain() *Blockchain {
    return &Blockchain{[]*Block{NewGenesisBlock()}}
    }

    func main() {
    bc := NewBlockchain()
    bc.AddBlock("Send 1 CUKC to Sally")
    bc.AddBlock("Send 2 more CUKC to Mike")
    for _, block := range bc.blocks {
    fmt.Printf("Prev. hash: %x\n", block.PrevBlockHash)
    fmt.Printf("Data: %s\n", block.Data)
    fmt.Printf("Hash: %x\n", block.Hash)
    fmt.Println()
    }
    }
    When is the ICO?

    Leave a comment:


  • SunnyInHades
    replied
    /*
    Simple blockchain using a CUKC - Contractor UK coin. Just like parts of Ethereum, written in the 'C like' Go language
    Code taken from Aug 2017 Ivan Kuznetsov article at https://jeiwan.cc/posts/building-blo...-in-go-part-1/
    To easily test copy'n'paste everything into the top part of the yellow 'Try Go' box at https://golang.org and press 'Run'
    */

    package main

    import (
    "bytes"
    "crypto/sha256"
    "strconv"
    "time"
    )

    import (
    "fmt"
    )

    type Block struct {
    Timestamp int64
    Data []byte
    PrevBlockHash []byte
    Hash []byte
    }

    type Blockchain struct {
    blocks []*Block
    }

    func (b *Block) SetHash() {
    timestamp := []byte(strconv.FormatInt(b.Timestamp, 10))
    headers := bytes.Join([][]byte{b.PrevBlockHash, b.Data, timestamp}, []byte{})
    hash := sha256.Sum256(headers)
    b.Hash = hash[:]
    }

    func NewBlock(data string, prevBlockHash []byte) *Block {
    block := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}}
    block.SetHash()
    return block
    }

    func NewGenesisBlock() *Block {
    return NewBlock("Genesis Block", []byte{})
    }

    func (bc *Blockchain) AddBlock(data string) {
    prevBlock := bc.blocks[len(bc.blocks)-1]
    newBlock := NewBlock(data, prevBlock.Hash)
    bc.blocks = append(bc.blocks, newBlock)
    }

    func NewBlockchain() *Blockchain {
    return &Blockchain{[]*Block{NewGenesisBlock()}}
    }

    func main() {
    bc := NewBlockchain()
    bc.AddBlock("Send 1 CUKC to Sally")
    bc.AddBlock("Send 2 more CUKC to Mike")
    for _, block := range bc.blocks {
    fmt.Printf("Prev. hash: %x\n", block.PrevBlockHash)
    fmt.Printf("Data: %s\n", block.Data)
    fmt.Printf("Hash: %x\n", block.Hash)
    fmt.Println()
    }
    }
    Last edited by SunnyInHades; 10 November 2017, 12:52.

    Leave a comment:


  • Jog On
    replied
    Good primer on ethereum here:

    https://www.coindesk.com/information/what-is-ethereum/

    The 'World Computer'

    In short, ethereum wants to be a 'World Computer' that would decentralize – and some would argue, democratize – the existing client-server model.

    With ethereum, servers and clouds are replaced by thousands of so-called "nodes" run by volunteers from across the globe (thus forming a "world computer").

    The vision is that ethereum would enable this same functionality to people anywhere around the world, enabling them to compete to offer services on top of this infrastructure.

    Leave a comment:


  • Jog On
    replied
    I've started reading up on Ethereum and 'smart contracts'. From what I've learnt it's a platform for a big virtual 'computer' that can run code but has no specific hardware, virtual server and centralized anything.

    I find smart contracts and 'crypto law' interesting as it opens the door for people to have peer-to-peer legal agreements (eg music royalty payments direct between artists and fans when downloading/streaming music) that are recorded on the blockchain. At the moment it would involve ether (ethereum currency) which if bitcoin is anything to go by is clunky, not instant and a PITA to set up, so don't see blockchain disrupting traditional music distribution and royalty payment systems soon.

    But if it became possible to link a paypal account or some similar quick and easy traditional payment method to peer-to-peer blockchain smart contracts (think buying selling cars, houses etc. without any Ebay/Amazon type middlemen) it could get very interesting indeed.

    I'm not that techy so have a lot more to understand but I like the potential of ethereum type 'apps' and contracts and peer-to-peer transactions.

    Leave a comment:


  • SunnyInHades
    replied
    Originally posted by Lance View Post
    The work under the bonnet is heavy-duty cryptographics.
    Tis, however on first look the lowest level Bitcoin crypto is probably 'inspired' rather than 'created from scratch'.

    2005 http://www.ouah.org/ogay/sha2/
    sha2.c
    uint64 sha512_h0[8] =
    {0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
    0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
    0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL};


    2012 C++ sha512 function :: zedwood.com
    sha512.cpp

    void SHA512::init()
    {
    m_h[0] = 0x6a09e667f3bcc908ULL;
    m_h[1] = 0xbb67ae8584caa73bULL;
    m_h[2] = 0x3c6ef372fe94f82bULL;
    m_h[3] = 0xa54ff53a5f1d36f1ULL;
    m_h[4] = 0x510e527fade682d1ULL;
    m_h[5] = 0x9b05688c2b3e6c1fULL;
    m_h[6] = 0x1f83d9abfb41bd6bULL;
    m_h[7] = 0x5be0cd19137e2179ULL;
    m_len = 0;
    m_tot_len = 0;
    }


    2017 Bitcoin
    bitcoin-master/src/crypto/sha512.cpp
    // Copyright (c) 2014 The Bitcoin Core developers

    void inline Initialize(uint64_t* s)
    {
    s[0] = 0x6a09e667f3bcc908ull;
    s[1] = 0xbb67ae8584caa73bull;
    s[2] = 0x3c6ef372fe94f82bull;
    s[3] = 0xa54ff53a5f1d36f1ull;
    s[4] = 0x510e527fade682d1ull;
    s[5] = 0x9b05688c2b3e6c1full;
    s[6] = 0x1f83d9abfb41bd6bull;
    s[7] = 0x5be0cd19137e2179ull;
    }

    Leave a comment:


  • SunnyInHades
    replied
    For sh*** and giggles just downloaded the latest Bitcoin Git repository and successfully compiled up
    on Ubuntu (Windows Subsystem For Linux). Pretty straight forward to do if u have Linux/C++ knowledge, takes about 30 mins.

    'aving a first browse through the source now ...
    All C++/.h, std containers etc. ..usual type of stuff if you've done C++/std on Linux coding, looks nice'n'clean ...

    Incredible that a free C++/UNIX project has created so much 'wealth' in such a short space of time !

    src/amount.h
    // Copyright (c) 2009-2010 Satoshi Nakamoto
    // Copyright (c) 2009-2016 The Bitcoin Core developers

    /** Amount in satoshis (Can be negative) */
    typedef int64_t CAmount;

    static const CAmount COIN = 100000000;
    static const CAmount CENT = 1000000;

    static const CAmount MAX_MONEY = 21000000 * COIN;



    src/utilmoneystr.cpp:
    // Copyright (c) 2009-2010 Satoshi Nakamoto
    // Copyright (c) 2009-2016 The Bitcoin Core developers

    std::string FormatMoney(const CAmount& n)
    {
    // Note: not using straight sprintf here because we do NOT want
    // localized number formatting.
    int64_t n_abs = (n > 0 ? n : -n);
    int64_t quotient = n_abs/COIN;
    int64_t remainder = n_abs%COIN;
    std::string str = strprintf("%d.%08d", quotient, remainder);

    // Right-trim excess zeros before the decimal point:
    int nTrim = 0;
    for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
    ++nTrim;
    if (nTrim)
    str.erase(str.size()-nTrim, nTrim);

    if (n < 0)
    str.insert((unsigned int)0, 1, '-');
    return str;
    }



    src/wallet/wallet.cpp
    // Copyright (c) 2009-2010 Satoshi Nakamoto
    // Copyright (c) 2009-2016 The Bitcoin Core developers

    bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
    {
    LOCK(cs_wallet);

    CWalletDB walletdb(*dbw, "r+", fFlushOnClose);

    uint256 hash = wtxIn.GetHash();

    Leave a comment:


  • Hobosapien
    replied
    Originally posted by sal View Post
    I would guess that using specific crypto currency mitigates the risk of someone stealing/extorting and hoarding the "cash" from the regular people, like it often happens with monetary and material aid in the 3rd world countries. You would be surprised how many people have access to a smart phone, but no access to real necessities like clean water fro example.
    Yup.

    There's a TV show called 'Startup' available on Amazon Prime Video (an Amazon original show, so not sure if available via other legit sources) and while it's fiction it does have cryptocurrency as the product they're doing as the startup.

    Only watched the first episode so far but they do say when talking to VCs to get funding, that the benefit of cryptocurrency is that it's easier to access all over the world (most people have or will soon have a mobile phone) without banks or government controlling the access and supply.

    The woman that built the solution (GenCoin IIRC) did say it took her 7 years to do the algorithm, so plenty of time yet before we see real world solutions.

    Maybe everyone is seeing how they did it on the show and copying the idea.

    Leave a comment:


  • Lance
    replied
    Originally posted by sal View Post
    I'm not overly familiar with the details of the project, to comment on the details. I would guess that using specific crypto currency mitigates the risk of someone stealing/extorting and hoarding the "cash" from the regular people, like it often happens with monetary and material aid in the 3rd world countries. You would be surprised how many people have access to a smart phone, but no access to real necessities like clean water fro example.

    What I know is that my friends are passionate about it as software developers and the guys that started it at IBM are passionate about making a change and clearing the plastic. But I agree that most likely the big wigs at IBM are looking at it as a vanity/PR project
    and to get IBM involved it has to have a technical solution.

    good luck to them though

    Leave a comment:


  • sal
    replied
    Originally posted by Lance View Post
    I like the use of technology, and the desire to clear up the plastic, but find the method quite disturbing.

    Why would you 'pay' the poor people with a currency that you control where they can spend? Why not give them US dollars (or other local currency, or even real Bitcoins) which they can choose to spend as they like. And do the collectors need to have a mobile phone to use the currency?

    At some stage the providers of the food and water will be getting actual cash so I'm not sure what problem the blockchain is solving here.

    Maybe I'm cynical but it looks like a huge vanity project.
    I'm not overly familiar with the details of the project, to comment on the details. I would guess that using specific crypto currency mitigates the risk of someone stealing/extorting and hoarding the "cash" from the regular people, like it often happens with monetary and material aid in the 3rd world countries. You would be surprised how many people have access to a smart phone, but no access to real necessities like clean water fro example.

    What I know is that my friends are passionate about it as software developers and the guys that started it at IBM are passionate about making a change and clearing the plastic. But I agree that most likely the big wigs at IBM are looking at it as a vanity/PR project

    Leave a comment:


  • NotAllThere
    replied
    Originally posted by Lance View Post
    ^^^^^ This is you're not a total maths propeller-head.

    The work under the bonnet is heavy-duty cryptographics. IMO that's where the real money is (and I don't mean enough knowledge to fork the Bitcoin source code and make your own alt-coin). The banks will pay very handsomely for people who really understand how it works and what it can be made to do. Although I suspect they'll recruit graduates with 1st class degrees from the top universitys rather than contractors.
    You don't need to understand the maths to exploit what it can do. There are applications way beyond finance and banks.

    Leave a comment:


  • Lance
    replied
    Originally posted by sal View Post
    I have friends that partnered with IBM on this:

    https://www.ibm.com/blogs/systems/pl...ocean-plastic/
    I like the use of technology, and the desire to clear up the plastic, but find the method quite disturbing.

    Why would you 'pay' the poor people with a currency that you control where they can spend? Why not give them US dollars (or other local currency, or even real Bitcoins) which they can choose to spend as they like. And do the collectors need to have a mobile phone to use the currency?

    At some stage the providers of the food and water will be getting actual cash so I'm not sure what problem the blockchain is solving here.

    Maybe I'm cynical but it looks like a huge vanity project.

    Leave a comment:


  • darmstadt
    replied
    Originally posted by sal View Post
    I have friends that partnered with IBM on this:

    https://www.ibm.com/blogs/systems/pl...ocean-plastic/
    This and other similar projects...

    Leave a comment:


  • sal
    replied
    I have friends that partnered with IBM on this:

    https://www.ibm.com/blogs/systems/pl...ocean-plastic/

    Leave a comment:


  • Lance
    replied
    Originally posted by NotAllThere View Post
    Get away from the idea of currency, and think in terms of audit trails and privacy.
    ^^^^^ This is you're not a total maths propeller-head.

    The work under the bonnet is heavy-duty cryptographics. IMO that's where the real money is (and I don't mean enough knowledge to fork the Bitcoin source code and make your own alt-coin). The banks will pay very handsomely for people who really understand how it works and what it can be made to do. Although I suspect they'll recruit graduates with 1st class degrees from the top universitys rather than contractors.

    Leave a comment:


  • NotAllThere
    replied
    One of my permie colleagues is developing a project using blockchain. What he's doing is nothing to do with my day to day work, but I can earwig on his conversations - and I've learned a lot. I can't give details at all, but suffice to say, if you're looking for a new area to work in, I think there's huge potential for exploitation. Get away from the idea of currency, and think in terms of audit trails and privacy.

    Leave a comment:

Working...
X