How to transact custom token instead of ethers using JSON rpc?

0 votes

i have a system that uses ETH for transaction and this is the code i have used..

var postData = {"jsonrpc":"2.0","method":"eth_sendTransaction","params": [{"from":"0x52f273a06a420453aa5b33c4f175395c9a1fddd8", "to": data.ethAddress, "value": 1e18}], "id":1}
    var url = 'http://localhost:8545/'
    var options = {
    method: 'post',
    body: postData,
    json: true,
    url: url
    }
    request(options, function (err, res, body) {
    if (err) {
        console.error('error posting json: ', err)
        throw err
    }
    var headers = res.headers
    var statusCode = res.statusCode
    console.log('headers: ', headers)
    console.log('statusCode: ', statusCode)
    console.log('body: ', body)
    })

Now i want to do the same tasks as for the existing system but instead of using ETH as tokens, i want to use my own custom tokens for transaction.. how can i do it?

Jul 10, 2018 in Blockchain by slayer
• 29,170 points
37 views

1 answer to this question.

0 votes
First create your custom token. Then develop a smart contract. After doing that you can deploy and start using it. Go through the following link and see how it is done in the tutorial:

https://www.ethereum.org/token
answered Jul 10, 2018 by digger
• 26,550 points

Related Questions In Blockchain

0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 17,020 points
418 views
0 votes
1 answer

How to access member functions of smart contract using web3?

I have implemented a similar feature and ...READ MORE

answered Aug 13, 2018 in Blockchain by slayer
• 29,170 points
78 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
157 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,550 points
3,747 views
0 votes
1 answer
0 votes
1 answer

How to get all address and send ethers in solidity using a loop?

I found a similar code somewhere: contract  Holders{ uint ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 26,550 points
201 views
0 votes
1 answer

how to get modification history of asset?

You can use GetHistoryForKey() API as shown ...READ MORE

answered Jul 9, 2018 in Blockchain by digger
• 26,550 points
367 views