Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    adonnini
    @adonnini

    @ttmc when a TRANSFER transaction is used to append/update, I will be spending "output 0" every time I append/update the asset. Is that what you meant here

    "the ---> arrow always means spending/transferring output 0 to the same owner."?

    Thanks

    Parvinder Thapar
    @psthapar
    Here's the sample code in Java for doing the Transfer operation....I can not tell where is the Output being "spent"?? @adonnini @ttmc any ideas?
    public String doTransfer(String txId, MetaData metaData, KeyPair keys) throws Exception {
        try {
    
    
            //which transaction you want to fulfill?
            FulFill fulfill = new FulFill();
            fulfill.setOutputIndex(0);
            fulfill.setTransactionId(txId);
    
    
            //build and send TRANSFER transaction
            Transaction transaction = BigchainDbTransactionBuilder
                    .init()
                    .addInput(null, fulfill, (EdDSAPublicKey) keys.getPublic())
                    .addOutput("1", (EdDSAPublicKey) keys.getPublic())
                    .addAssets(txId, String.class)
                    .addMetaData(metaData)
                    .operation(Operations.TRANSFER)
                    .buildAndSign((EdDSAPublicKey) keys.getPublic(), (EdDSAPrivateKey) keys.getPrivate())
                    .sendTransaction(handleServerResponse());
    
            System.out.println("(*) TRANSFER Transaction sent.. - " + transaction.getId());
            return transaction.getId();
    
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
    adonnini
    @adonnini
    @psthapar this is the code from the sample app published by @innoprenuer and similar to the code in read.md for the Java driver.
    The problem is that we do not know whether this code was tested and runs correctly.
    @ttmc I am not asking for support from @innoprenuer, just whether the code he posted in the sample app and in read.md was tested and works. Could we please get an answer to this question?
    Thanks
    Parvinder Thapar
    @psthapar
    OK. I seem to have it working. In the "Fulfill" construct, I use the last transaction's id. ...and inside the "Transfer" construct usting BigChainDBTransactionBuilder where it's referencing "addAsset", i used the original "Create" Transaction Id. My 3rd Transfer went smoothly and it added the new metadata (from Transfer Operation #3) to the originally created Asset....essentially mimicking the "append" behavior that @adonnini and I were trying to get.
    @adonnini Correct....I am using the sample code and was trying to make multiple "transfers" to mimic append behavior just like what you were trying to do
    adonnini
    @adonnini
    @psthapar in the code above the original trx id, txId, is used for both addAsset and for fullfill Is this what you meant?
    adonnini
    @adonnini
    @psthapar What is not clear to me how you would retain the transaction id of the last append transaction over time.
    For example, suppose the app updates/appends on day 1 twice. Assuming the application runs continuously, I can see having a construct that retains the trx id of the first append/update operation, and uses it, as I think you suggest, for the second append/update operation.
    Now suppose, instead that the app appends/updates an asset on day 1. Then on day X, it appends/updates the same asset again. In order for the app to know/use the trx id of the append/update transaction performed on day 1, it wold need to be able to retrieve it from somewhere.
    Am I missing something? Did I misunderstand how you built the append/update transaction in your code?
    Thanks
    Parvinder Thapar
    @psthapar
    @adonnini Good question. You can use the static method on the Class TransactionAPI called getTransactionsByAssetId to retrieve all the transactions. The last transaction's id is what you need to send for subsequent Transfers. All you need is Asset Id (or original createTransaction's ID) for the method getTransactionsByAssetId. Hope this helps,
    Here's the updated doTransfer Method:
    public Transaction doTransfer(String lastTxId, String createTxId, MetaData metaData, KeyPair keys) throws Exception {
    
        try {
    
    
            //which transaction you want to fulfill?
            FulFill fulfill = new FulFill();
            fulfill.setOutputIndex(0);
            fulfill.setTransactionId(lastTxId);
    
    
            //build and send TRANSFER transaction
            Transaction transaction = BigchainDbTransactionBuilder
                    .init()
                    .addInput(null, fulfill, (EdDSAPublicKey) keys.getPublic())
                    .addOutput("1", (EdDSAPublicKey) keys.getPublic())
                    .addAssets(createTxId, String.class)
                    .addMetaData(metaData)
                    .operation(Operations.TRANSFER)
                    .buildAndSign((EdDSAPublicKey) keys.getPublic(), (EdDSAPrivateKey) keys.getPrivate())
                    .sendTransaction(handleServerResponse());
    
            System.out.println("(*) TRANSFER Transaction sent.. - " + transaction.getId());
            return transaction;
    
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
    adonnini
    @adonnini

    @psthapar Thanks for the help. I appreciate it. To make sure I understand correctly what you are saying above:

    lastTxId = appendTransactions.get(appendTransactions.size() - 1).getId();
    where
    apAppendTransactions = appendTransactionRetrieve.getTransactionsByAssetId(originalTxId, Operations.TRANSFER).getTransactions();

    and

    createTxId = originalTxId;

    Did I understand you correctly?

    Parvinder Thapar
    @psthapar
    @adonnini Yes. Barring the syntax, your psuedo code seems right. Try it out and let me know.
    adonnini
    @adonnini
    @psthapar It seems to be working as expected. I had to make a few changes to allow for how I used the blockchain but it seems to work. Again, thanks.
    Parvinder Thapar
    @psthapar
    Great. Thanks for letting me know @adonnini . You are very welcome. Glad it worked out for you.
    Parvinder Thapar
    @psthapar
    Hi all, BigChain DB talks about "Burn" capability to essentially mimic "delete" (since an asset cannot be essentially be deleted in the world of blockchain). Is there any examples of "burning" an asset using Java libraries?
    CC: @adonnini @ttmc
    Troy McConaghy
    @ttmc
    @psthapar It's not complicated, you just transfer the asset to a public key where the associated private key is not known. The asset still exists in an unspent transaction output, but nobody can spend it.
    Parvinder Thapar
    @psthapar
    @ttmc aah....makes sense. However, even with an unspent transaction output, the asset would still be query-able and found. Wouldn't it (just wondering!?). One of my goals is to ensure that once burned, it's never found again, even in read-mode. Thoughts?
    Troy McConaghy
    @ttmc
    @psthapar The nature of most normal blockchains (like BigchainDB) is that:
    1) all the stored data is publicly readable (and auditable) forever.
    2) no stored data can be deleted or changed.
    If that's not what you want, then you don't want a blockchain.
    Parvinder Thapar
    @psthapar
    @ttmc Not what I wanted to hear but it is what it is :-) .... Thanks.
    The only strategy that I can think of to get close to what I want is:
    1) Use Private/ Permissioned Blockchain
    2) Use Business Logic Layer to manage data and use strategies to limit (or eliminate) views to burned assets such as purging assetId, public & private keys etc.
    Understandable it's not fail-proof but having some strategy is better than not having one at all. My 2 cents!
    Troy McConaghy
    @ttmc
    Yes, a private blockchain can certainly restrict read access, but that happens outside the blockchain itself.
    Parvinder Thapar
    @psthapar
    Yep. Agreed. Thanks.
    CodyMTX
    @CodyMTX
    I'm having an issue posting transactions
    is this where I would get some insight?
    Parvinder Thapar
    @psthapar
    Hi @CodyMTX what drivers are you using? js or java drivers?
    CodyMTX
    @CodyMTX
    @psthapar I am using JavaScript and also got the error with the Python drivers...leading me to believe it may be a configuration issue on my part? I have the docker installation running flawlessly, but can't seem to replicate it outside in a prod env
    Diego Sierra Fernandez
    @jdiegosierra
    Is someone using js-driver-orm?
    I'm trying to change the owner of an asset but when it reachs the append nothing happends.
    router.post('/transfer', function(req, res) {
        conn.searchAssets(req.body.assetName)
        .then(assets => {
            const did = new DID(req.body.assetPublicKey);
            did.define(req.body.modelName);
            did.models[req.body.modelName]
            .retrieve(assets[0].id)
            .then(asset => {
                console.log(asset)
                // [ OrmObject {
                //     _name: 'test',
                //     _schema: undefined,
                //     _connection:
                //      Connection {
                //        path: 'http://localhost:9984/api/v1/',
                //        headers: {},
                //        conn: [Connection] },
                //     _appId: 'global',
                //     transactionHistory: [ [Object] ],
                //     id: 'id:global:test:99040993-0fa3-4c32-9d54-f6d83a65fb1f',
                //     data: { myData: '', ownerName: 'Juan Diego' } } ]
                return asset.append({
                    toPublicKey: req.body.destPublicKey,
                    keypair: req.body.ownerKeyPair,
                    data: {
                        myData: req.body.data,
                        ownerName: req.body.ownerName
                    }
                })
            })
            .then(updatedAsset => {
                console.log("This message does not appear")
                console.log(updatedAsset);
                res.send(updatedAsset);
            })
        })
    });
    Shivank Chopra
    @ShivankChopra
    Hi everyone. For testing the tamper resistance of data stored on bigchainDB, I intentionally changed the asset and metadata stored on the bigchain mongo database to random values. But it didnt seem to affect the working of bigchain db node. Should'nt the blockchain become invalid due to changed hash value because of this?
    Vishal1010101
    @Vishal1010101
    I am having an issue in this line of code
    const alice = new BigchainDB.Ed25519Keypair(seed)
    at Object.encode (/Users/apple/Documents/big_chaindb/node_modules/base-x/index.js:29:41)
    at new Ed25519Keypair (/Users/apple/Documents/big_chaindb/node_modules/bigchaindb-driver/dist/node/Ed25519Keypair.js:28:33)

    /Users/apple/Documents/big_chaindb/node_modules/base-x/index.js:29
    if (!Buffer.isBuffer(source)) throw new TypeError('Expected Buffer')
    ^

    TypeError: Expected Buffer

    can anyone help
    Troy McConaghy
    @ttmc
    @Vishal1010101 I think something is wrong with the JS driver in npm. If you get the JS driver straight from GitHub, I think that one is working. https://github.com/bigchaindb/js-bigchaindb-driver
    Vishal1010101
    @Vishal1010101
    Thanks man @ttmc seems like there is an issue with the Ed25519Keypair.js file through npm.
    It's solved in the github commit.
    Vishal1010101
    @Vishal1010101
    querying for the metadata gives an error where as assets is working fine with the url
    @ttmc
    status: '500 INTERNAL SERVER ERROR'
    Vishal1010101
    @Vishal1010101
    also changing the url to http://localhost:9984/api/v1/ in api_path is also giving an error { FetchError: request to http://localhost:9984/api/v1/metadata?search=1.32 failed, reason: connect ECONNREFUSED 127.0.0.1:9984
    Troy McConaghy
    @ttmc
    @Vishal1010101 Put double quotes (%22) around the 1.32 in the requestURI, e.g. https://test.bigchaindb.com/api/v1/metadata?search=%221.32%22
    Vishal1010101
    @Vishal1010101
    @tttmc why we have to give a specific url in the API_PATH shouldn't it be working with "https://test.bigchaindb.com/api/v1/" as it is working fine with assets
    Troy McConaghy
    @ttmc
    I don't know. Reality is strange, sometimes.
    Vishal1010101
    @Vishal1010101
    @ttmc indeed it is
    Vishal1010101
    @Vishal1010101
    FetchError: request to http://localhost:9984/api/v1/transactions?mode=commit failed, reason: connect ECONNREFUSED 127.0.0.1:9984
    Vishal1010101
    @Vishal1010101
    @ttmc help man
    Troy McConaghy
    @ttmc
    @Vishal1010101 Do other endpoints work? Such as just http://localhost:9984
    Vishal1010101
    @Vishal1010101
    yes it does
    i am using the docs and running the same code
    abhi-nilekar
    @abhi-nilekar
    hello guys , i installed bigchaindb-driver but still getting an error saying bip39 is not found , how should i fix it ??
    Troy McConaghy
    @ttmc
    @abhi-nilekar The JavaScript driver available from npm is broken (and I don't know how to fix it) but I do know that the JavaScript driver available directly from the JavaScript driver GitHub repo is working, at least in that regard. See https://github.com/bigchaindb/js-bigchaindb-driver