I want to build the backend in Django using django channels that access the realtime blockchain data.

Here is my smart contract.

mapping(uint => Task) public tasks;

event TaskCreated(
    uint id,
    string content,
    bool completed

function createTask(string memory _content) public {
    taskCount ++;
    tasks[taskCount] = Task(taskCount, _content, false);
    emit TaskCreated(taskCount, _content, false);

How can I access the value of tasks in realtime whenever TaskCreated event is fired.

I need the web3py code, and logic to implement with WebSockets (django channels).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.