Git Product home page Git Product logo

erc865-token-demo's Introduction

ERC865-Token-Demo

This demo is to show how ER865 standard token is used for delegate the gas fee for token transfer between the users.

This package contains the Sample ERC865 standard token contarct and UI packages.

Kindly check with that in a basic UI.

Steps to deploy

  1. Download the package to your local machine.

  2. Unzip the package and you can find the SampleERC865 solidity contract file for your reference and UI public folder which contains the UI packages.

  3. You should have NodeJS installed in your machine.

  4. Check whether port 8337 is open.

  5. Just run the server file as $node server.js and open the link http://localhost:8337/ and you will find the UI.

  6. You should have metamask extension installed in your browser (Recommended : Chrome) and should be unlocked.

  7. Then click on Fetch metamask button to fetch the respective account details also check there should be some ether loaded in the account.

  8. Click get ERC 865 Token button to receive 100 tokens for testing purpose.

  9. Input to_address, value and fee, then click on create signature.

  10. Switch from create tab to Execute tab.

  11. Select a different metamnask account which should have only some ethers in it.

  12. Select the checkbox and click on delegate transfer button and now you will find the tokens transferred to the beneficiary and delegator.

  13. Click fetch metamask and check whether you have received the fee (amount of ERC 865 Token) whatever mentioned during signature creation.

For further queries reach me out.

[email protected]

https://www.linkedin.com/in/grashias/

erc865-token-demo's People

Contributors

grashias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

erc865-token-demo's Issues

transferPresigned

Hi, I deploy a new token with your contract erc865, and i want to use web3js without metamask, i test your code with my ABI and ContractAddress, the transaction working nice with metamask, but without, i have an error on ertherscan...
I can have the hash with function recoverPreSignedHash and sign with web3.eth.accounts.sign with private key of signer(sender). I think the problem come from the transaction

`

var amount = web3.utils.toHex(1000000000000000000)
var fees = web3.utils.toHex(100000000000000000)

const privateKey1 = Buffer.from('private_key_deleguate', 'hex')
var gasPrice = '21000000000';

web3.eth.getTransactionCount(deleguate, (err, txCount) => {
    if (err) {
        console.error(err);
        return err;
    }
    console.log(txCount)
    // Build the transaction
    const txObject = {
        "chainId": 4,
        "from": deleguate,
        "nonce": web3.utils.toHex(txCount),
        "gasPrice": web3.utils.toHex(gasPrice),
        "gasLimit": web3.utils.toHex(800000),
        "to": ContractAddress,
        "value": "0x00",
        "data":
            //contract.methods.transfer(receiver, amount).encodeABI() ---> this work fine
            contract.methods.transferPreSigned(signature, receiver, amount, fees, web3.utils.toHex(txCount)).encodeABI()
    }

    // Sign the transaction
    const tx = new Tx(txObject)
    tx.sign(privateKey1)
    const raw = "0x" + tx.serialize().toString('hex');

    web3.eth.sendSignedTransaction(raw, (err, result) => {
        if (err) return console.error('error ', err);
        console.log('send token hash Tx: ', result);

    }).on('receipt', receipt => {
        //console.log('------> ', receipt)
        return { "code": 200, "message": "transfer token succeed", "address": receipt };
    }).on('error -> ', error => {
        console.error(userWallet, "Error send token ", error);
        return { "code": 409, "error": "sign transaction error" };
    });

`

This code give me a hash Tx etherscan like this: https://rinkeby.etherscan.io/tx/0x421b8bdc2bcdde652b0fb785221de51e0c93bd3c116fd0a39f4d7ab7966b3361
Does anybody have a help ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.